Inserts a $fieldDefinition for $typeId.
abstract public insertFieldDefinition ( mixed $typeId, integer $status, eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition, |
||
$typeId | mixed | |
$status | integer | |
$fieldDefinition | eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition | |
$storageFieldDef | ||
리턴 | mixed | Field definition ID |
/** * Inserts a $fieldDefinition for $typeId. * * @param mixed $typeId * @param int $status * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageFieldDef * * @return mixed Field definition ID */ public function insertFieldDefinition($typeId, $status, FieldDefinition $fieldDefinition, StorageFieldDefinition $storageFieldDef) { try { return $this->innerGateway->insertFieldDefinition($typeId, $status, $fieldDefinition, $storageFieldDef); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Adds a new field definition to an existing Type. * * This method creates a new status of the Type with the $fieldDefinition * added. It does not update existing content objects depending on the * field (default) values. * * @param mixed $contentTypeId * @param int $status One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDefinition * * @return void */ public function addFieldDefinition( $contentTypeId, $status, FieldDefinition $fieldDefinition ) { $storageFieldDef = new StorageFieldDefinition(); $this->mapper->toStorageFieldDefinition( $fieldDefinition, $storageFieldDef ); $fieldDefinition->id = $this->contentTypeGateway->insertFieldDefinition( $contentTypeId, $status, $fieldDefinition, $storageFieldDef ); }