eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter::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)
    {
        $storageDef->dataInt3 = (int) $fieldDef->defaultValue->data;
    }

Usage Example

 /**
  * @group fieldType
  * @group ezboolean
  * @covers \eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter::toStorageFieldDefinition
  */
 public function testToStorageFieldDefinition()
 {
     $defaultBool = false;
     $storageFieldDef = new StorageFieldDefinition();
     $defaultValue = new FieldValue();
     $defaultValue->data = $defaultBool;
     $fieldDef = new PersistenceFieldDefinition(array('defaultValue' => $defaultValue));
     $this->converter->toStorageFieldDefinition($fieldDef, $storageFieldDef);
     self::assertSame((int) $fieldDef->defaultValue->data, $storageFieldDef->dataInt3);
 }