eZ\Publish\Core\FieldType\BinaryBase\Type::fromPersistenceValue PHP Method

fromPersistenceValue() public method

This method builds a field type value from the $data and $externalData properties.
public fromPersistenceValue ( eZ\Publish\SPI\Persistence\Content\FieldValue $fieldValue ) : eZ\Publish\Core\FieldType\BinaryBase\Value
$fieldValue eZ\Publish\SPI\Persistence\Content\FieldValue
return eZ\Publish\Core\FieldType\BinaryBase\Value
    public function fromPersistenceValue(PersistenceValue $fieldValue)
    {
        // Restored data comes in $data, since it has already been processed
        // there might be more data in the persistence value than needed here
        $result = $this->fromHash(array('id' => isset($fieldValue->externalData['id']) ? $fieldValue->externalData['id'] : null, 'fileName' => isset($fieldValue->externalData['fileName']) ? $fieldValue->externalData['fileName'] : null, 'fileSize' => isset($fieldValue->externalData['fileSize']) ? $fieldValue->externalData['fileSize'] : null, 'mimeType' => isset($fieldValue->externalData['mimeType']) ? $fieldValue->externalData['mimeType'] : null, 'uri' => isset($fieldValue->externalData['uri']) ? $fieldValue->externalData['uri'] : null));
        return $result;
    }

Usage Example

Beispiel #1
0
 /**
  * Converts a persistence $fieldValue to a Value.
  *
  * This method builds a field type value from the $data and $externalData properties.
  *
  * @param \eZ\Publish\SPI\Persistence\Content\FieldValue $fieldValue
  *
  * @return \eZ\Publish\Core\FieldType\Media\Value
  */
 public function fromPersistenceValue(FieldValue $fieldValue)
 {
     if ($fieldValue->externalData === null) {
         return $this->getEmptyValue();
     }
     $result = parent::fromPersistenceValue($fieldValue);
     $result->hasController = isset($fieldValue->externalData['hasController']) ? $fieldValue->externalData['hasController'] : false;
     $result->autoplay = isset($fieldValue->externalData['autoplay']) ? $fieldValue->externalData['autoplay'] : false;
     $result->loop = isset($fieldValue->externalData['loop']) ? $fieldValue->externalData['loop'] : false;
     $result->height = isset($fieldValue->externalData['height']) ? $fieldValue->externalData['height'] : 0;
     $result->width = isset($fieldValue->externalData['width']) ? $fieldValue->externalData['width'] : 0;
     return $result;
 }
All Usage Examples Of eZ\Publish\Core\FieldType\BinaryBase\Type::fromPersistenceValue