eZ Unconference#2 - Fieldtype - A. Rømcke

727 views
649 views

Published on

eZ Unconference

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
727
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
12
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

eZ Unconference#2 - Fieldtype - A. Rømcke

  1. 1. ss
  2. 2. 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
  3. 3. What is a datatype (aka FieldType)
  4. 4. Updated GlossaryeZ Publish 4 eZ Publish 5Content object ContentContent class Content TypeContent object attribute FieldContent class attribute Field DefinitionObject attribute content Field ValueDatatype Field Type
  5. 5. How it is consumed
  6. 6. FieldType APIeZPublishSPIFieldTypeFieldType• getFieldTypeIdentifier• acceptValue / getEmptyValue• fromHash / toHash• fromPersistenceValue / toPersistenceValue• getSettingsSchema /getValidatorConfigurationSchema• validateFieldSettings / validateValidatorConfiguration• validate• getName• isSearchable
  7. 7. FieldType SPI (interfaces to implement)•eZPublishSPIFieldTypeFieldStorage• storeFieldData• getFieldData• deleteFieldData• hasFieldData• getIndexData•eZPublishSPIFieldTypeIndexable•eZPublishSPIFieldTypeValidationError
  8. 8. FieldType API abstract classeseZPublishCoreFieldTypeFieldType• Abstract that implements …SPIFieldTypeFieldType• Default behavior of some methods + validator handlingNeeded for Legacy Storage Engine:eZPublishCoreFieldTypeGatewayBasedStorage• Abstract that implements …SPIFieldTypeFieldStorageeZPublishCoreFieldTypeStorageGateway• Abstract for gateways to external storage• Used by GatewayBasedStorageeZPublishCorePersistenceLegacyContentFieldValueConverter
  9. 9. FieldType API abstract classes #2•eZPublishCoreFieldTypeValue• Abstract for field value•eZPublishCoreFieldTypeValidationError• Implementation of…SPIFieldTypeValidationError•eZPublishCoreFieldTypeValidator• Abstract for all validators to extend•eZPublishCoreIOIOService• Binary files IO handling
  10. 10. FieldType standardized unit/integration tests•API integration tests• Using real world implementation of repository• Tests if our field type plays well with others• eZPublishAPIRepositoryTestsFieldTypeTextLineIntegrationTest.php•SPI integration tests• Hooks directly into persistence implementation• Tests if our field type stores and loads data correctly• eZPublishSPITestsFieldTypeTextLineIntegrationTest.php•Unit testing of the field type• Tests the field type methods (units), one by one• eZPublishCoreFieldTypeTestsTextLineTest.php•TDD is your friend. Really!
  11. 11. 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
  12. 12. The end?Twitter: @bdunogier & @andreromGoogle+: http://gplus.to/BertrandDunogierSlideShare: http://slideshare.net/BertrandDunogier

×