DataMapper/ModelDataMapper.php
protected function setDefaultElementValue(ElementInterface $element)
    {
        $propertyPath = $element->getPropertyPath();
        
        if ($propertyPath instanceof PropertyPathInterface) {
            if ($this->propertyAccessor->isReadable($this->data, $propertyPath)) {
                $value = $this->propertyAccessor->getValue($this->data, $propertyPath);
                if ($this->isEmptyValue($value)) {
                    $value = $element->getDefaultValue();
                }
                
                if ($element->hasTransformer() && is_object($value)) {
                    $transformer = $element->getTransformer();
                    $value       = $transformer->transform($value);
                }
                
                $element->setValue($value);
            }
        }
    }
protected function setDefaultElementValue(ElementInterface $element)
    {
        $propertyPath = $element->getPropertyPath();
        
        if ($propertyPath instanceof PropertyPathInterface) {
            if ($this->propertyAccessor->isReadable($this->data, $propertyPath)) {
                $value = $this->propertyAccessor->getValue($this->data, $propertyPath);
                if ($this->isEmptyValue($value)) {
                    $value = $element->getDefaultValue();
                }
                
                if ($element->hasTransformer() && is_object($value)) {
                    $transformer = $element->getTransformer();
                    $value       = $transformer->transform($value);
                }
                
                $element->setValue($value);
            }
        }
    }
protected function setDefaultElementValue ( ElementInterface $ element ) { $ propertyPath = $ element -> getPropertyPath ( ) ; if ( $ propertyPath instanceof PropertyPathInterface ) { if ( $ this -> propertyAccessor -> isReadable ( $ this -> data , $ propertyPath ) ) { $ value = $ this -> propertyAccessor -> getValue ( $ this -> data , $ propertyPath ) ; if ( $ this -> isEmptyValue ( $ value ) ) { $ value = $ element -> getDefaultValue ( ) ; } if ( $ element -> hasTransformer ( ) && is_object ( $ value ) ) { $ transformer = $ element -> getTransformer ( ) ; $ value = $ transformer -> transform ( $ value ) ; } $ element -> setValue ( $ value ) ; } } }
Sets value for element

@param ElementInterface $element
Sets value for element