src/View/ActionHandler/AbstractPropertyOverrideEditAllHandler.php
protected function getPropertyValueBagFromModel(
        Action $action,
        ModelInterface $model,
        EnvironmentInterface $environment
    ) {
        $propertiesDefinition = $environment->getDataDefinition()->getPropertiesDefinition();
        $editInformation      = $GLOBALS['container']['dc-general.edit-information'];

        $propertyValueBag = new PropertyValueBag();

        foreach ($model->getPropertiesAsArray() as $propertyName => $propertyValue) {
            if (!$propertiesDefinition->hasProperty($propertyName)) {
                continue;
            }

            $property = $propertiesDefinition->getProperty($propertyName);
            if (!$property->getWidgetType()) {
                continue;
            }

            $modelError = $editInformation->getModelError($model);
            if ($modelError && isset($modelError[$propertyName])) {
                $sessionValues = $this->getEditPropertiesByModelId($action, ModelId::fromModel($model), $environment);

                $propertyValueBag->setPropertyValue($propertyName, $sessionValues[$propertyName]);
                $propertyValueBag->markPropertyValueAsInvalid($propertyName, $modelError[$propertyName]);

                continue;
            }

            $propertyValueBag->setPropertyValue($propertyName, $propertyValue);
        }

        return $propertyValueBag;
    }
protected function getPropertyValueBagFromModel(
        Action $action,
        ModelInterface $model,
        EnvironmentInterface $environment
    ) {
        $propertiesDefinition = $environment->getDataDefinition()->getPropertiesDefinition();
        $editInformation      = $GLOBALS['container']['dc-general.edit-information'];

        $propertyValueBag = new PropertyValueBag();

        foreach ($model->getPropertiesAsArray() as $propertyName => $propertyValue) {
            if (!$propertiesDefinition->hasProperty($propertyName)) {
                continue;
            }

            $property = $propertiesDefinition->getProperty($propertyName);
            if (!$property->getWidgetType()) {
                continue;
            }

            $modelError = $editInformation->getModelError($model);
            if ($modelError && isset($modelError[$propertyName])) {
                $sessionValues = $this->getEditPropertiesByModelId($action, ModelId::fromModel($model), $environment);

                $propertyValueBag->setPropertyValue($propertyName, $sessionValues[$propertyName]);
                $propertyValueBag->markPropertyValueAsInvalid($propertyName, $modelError[$propertyName]);

                continue;
            }

            $propertyValueBag->setPropertyValue($propertyName, $propertyValue);
        }

        return $propertyValueBag;
    }
protected function getPropertyValueBagFromModel ( Action $ action , ModelInterface $ model , EnvironmentInterface $ environment ) { $ propertiesDefinition = $ environment -> getDataDefinition ( ) -> getPropertiesDefinition ( ) ; $ editInformation = $ GLOBALS [ 'container' ] [ 'dc-general.edit-information' ] ; $ propertyValueBag = new PropertyValueBag ( ) ; foreach ( $ model -> getPropertiesAsArray ( ) as $ propertyName => $ propertyValue ) { if ( ! $ propertiesDefinition -> hasProperty ( $ propertyName ) ) { continue ; } $ property = $ propertiesDefinition -> getProperty ( $ propertyName ) ; if ( ! $ property -> getWidgetType ( ) ) { continue ; } $ modelError = $ editInformation -> getModelError ( $ model ) ; if ( $ modelError && isset ( $ modelError [ $ propertyName ] ) ) { $ sessionValues = $ this -> getEditPropertiesByModelId ( $ action , ModelId :: fromModel ( $ model ) , $ environment ) ; $ propertyValueBag -> setPropertyValue ( $ propertyName , $ sessionValues [ $ propertyName ] ) ; $ propertyValueBag -> markPropertyValueAsInvalid ( $ propertyName , $ modelError [ $ propertyName ] ) ; continue ; } $ propertyValueBag -> setPropertyValue ( $ propertyName , $ propertyValue ) ; } return $ propertyValueBag ; }
Get property value bag from the model.

@param Action               $action      The action.
@param ModelInterface       $model       The model.
@param EnvironmentInterface $environment The environment.

@return PropertyValueBag

@throws DcGeneralInvalidArgumentException If create property value bug, the construct argument isn´t right.

@SuppressWarnings(PHPMD.Superglobals)
Get property value bag from the model .