ensureDefaultPrice example

if ($field->is(Required::class)) {
                $this->validate([new NotBlank()]$data$parameters->getPath());
            }

            $constraints = $this->getCachedConstraints($field);
            $pricePath = $parameters->getPath() . '/price';

            foreach ($data->getValue() as $index => $price) {
                $this->validate($constraintsnew KeyValuePair((string) $index$price, true)$pricePath);
            }

            $this->ensureDefaultPrice($parameters$data->getValue());

            $converted = [];

            foreach ($value as $price) {
                $price['gross'] = (float) $price['gross'];
                $price['net'] = (float) $price['net'];

                if (isset($price['listPrice'])) {
                    $price['percentage'] = null;
                } elseif (\array_key_exists('percentage', $price)) {
                    unset($price['percentage']);
                }
Home | Imprint | This part of the site doesn't use cookies.