eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\BinaryFileConverter::toFieldDefinition PHP Method

toFieldDefinition() public method

Converts field definition data in $storageDef into $fieldDef.
public toFieldDefinition ( StorageFieldDefinition $storageDef, eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef )
$storageDef eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition
$fieldDef eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
    public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
    {
        $fieldDef->fieldTypeConstraints = new FieldTypeConstraints(array('validators' => array('FileSizeValidator' => array('maxFileSize' => $storageDef->dataInt1 != 0 ? $storageDef->dataInt1 : null))));
    }

Usage Example

 /**
  * Converts field definition data in $storageDef into $fieldDef.
  *
  * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef
  * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef
  */
 public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
 {
     parent::toFieldDefinition($storageDef, $fieldDef);
     $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings(array('mediaType' => $storageDef->dataText1));
 }