eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\TextBlockConverter::toStorageFieldDefinition PHP Method

toStorageFieldDefinition() public method

Converts field definition data in $fieldDef into $storageFieldDef.
public toStorageFieldDefinition ( eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef, StorageFieldDefinition $storageDef )
$fieldDef eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
$storageDef eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition
    public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
    {
        if (isset($fieldDef->fieldTypeConstraints->fieldSettings['textRows'])) {
            $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->fieldSettings['textRows'];
        }
    }

Usage Example

 /**
  * @group fieldType
  * @group textBlock
  * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\TextBlockConverter::toStorageFieldDefinition
  */
 public function testToStorageFieldDefinition()
 {
     $storageFieldDef = new StorageFieldDefinition();
     $fieldTypeConstraints = new FieldTypeConstraints();
     $fieldTypeConstraints->fieldSettings = new FieldSettings(array('textRows' => 15));
     $fieldDef = new PersistenceFieldDefinition(array('fieldTypeConstraints' => $fieldTypeConstraints, 'defaultValue' => new TextBlockValue()));
     $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
     self::assertSame(15, $storageFieldDef->dataInt1);
 }