Upload
ez-publish-community
View
598
Download
5
Embed Size (px)
DESCRIPTION
eZ Unconference
Citation preview
s s
What is a Field Type
• Base building block of all content in eZ Publish • Collection of methods to store, read and validate content
• Object oriented architecture of content model
• Content type – blueprint of a single piece of content • Collection of class attributes, which are of some (data)type
• Content – a single piece of content • Instance of a class • Collection of Fields, values of FieldDefinitions
What is a datatype (aka FieldType)
Updated Glossary
eZ Publish 4 eZ Publish 5 Content object Content Content class Content Type Content object attribute Field Content class attribute Field Definition Object attribute content Field Value Datatype Field Type
How it is consumed
FieldType API
eZ\Publish\SPI\FieldType\FieldType • getFieldTypeIdentifier • acceptValue / getEmptyValue • fromHash / toHash • fromPersistenceValue / toPersistenceValue • getSettingsSchema /
getValidatorConfigurationSchema • validateFieldSettings / validateValidatorConfiguration • validate • getName • isSearchable
FieldType SPI (interfaces to implement)
•eZ\Publish\SPI\FieldType\FieldStorage • storeFieldData • getFieldData • deleteFieldData • hasFieldData • getIndexData
•eZ\Publish\SPI\FieldType\Indexable
•eZ\Publish\SPI\FieldType\ValidationError
FieldType API abstract classes
eZ\Publish\Core\FieldType\FieldType • Abstract that implements …\SPI\FieldType\FieldType • Default behavior of some methods + validator handling
Needed for Legacy Storage Engine:
eZ\Publish\Core\FieldType\GatewayBasedStorage • Abstract that implements …\SPI\FieldType\FieldStorage
eZ\Publish\Core\FieldType\StorageGateway
• Abstract for gateways to external storage • Used by GatewayBasedStorage
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Con
verter
FieldType API abstract classes #2
•eZ\Publish\Core\FieldType\Value • Abstract for field value
•eZ\Publish\Core\FieldType\ValidationError
• Implementation of …\SPI\FieldType\ValidationError
•eZ\Publish\Core\FieldType\Validator
• Abstract for all validators to extend
•eZ\Publish\Core\IO\IOService • Binary files IO handling
FieldType standardized unit/integration tests
•API integration tests
• Using real world implementation of repository • Tests if our field type plays well with others • eZ\Publish\API\Repository\Tests\FieldType\TextLineIntegrationTest.php
•SPI integration tests • Hooks directly into persistence implementation • Tests if our field type stores and loads data correctly • eZ\Publish\SPI\Tests\FieldType\TextLineIntegrationTest.php
•Unit testing of the field type • Tests the field type methods (units), one by one • eZ\Publish\Core\FieldType\Tests\TextLineTest.php
•TDD is your friend. Really!
What about BC
•Right now: Think dual kernel
• Datatype [legacy] for the backoffice
• FieldType [5.x] for the front
•Yes, you currently have to write both
The end
?
Twitter: @bdunogier & @andrerom Google+: http://gplus.to/BertrandDunogier SlideShare: http://slideshare.net/BertrandDunogier