Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

eZ publish 5[-alpha1] Introduction & Architecture

3,380 views

Published on

eZ publish 5 Introduction & Architecture presentation held during eZ Summer Camp 2012 in Bol, Croatia. Gives and introduction to eZ Publish 5 and orientation on where the different parts currently exists for alpha1.

Updated prestentions will be held during eZ Conferance Köln on October 17th 2012.

Published in: Technology
  • Be the first to comment

eZ publish 5[-alpha1] Introduction & Architecture

  1. 1. Climbing KilimanjaroeZ Publish 5: Introduction & Architecture
  2. 2. About the speakers  André Rømcke, eZ Systems, @andrerom  Petar Spanja, NetGen, @periklo! Presenter: André Rømcke ! 09/04/12 2
  3. 3. Agenda Wednesday  eZ Publish 5: Introduction & Architecture − Using eZ Publish 5: Public API − Extending eZ Publish 5: SPI’s − Hacking eZ Publish 5: Core − Public API Code Workshop  Extending eZ Publish 5: Deep dive into Datatypes Thursday  Symfony  eZ Publish 5 & Symfony Friday  REST API  Hackaton! Presenter: André Rømcke ! 09/04/12 3
  4. 4. Architecture of eZ Publish 5.xWhy a new architecture?! Presenter: André Rømcke ! 09/04/12 4
  5. 5. Why a new architecture?Code speaks better then words? * NOTE: you have to provide the following attributes: * contentobject_id * contentobject_attribute_id * * @param array $row * @return object */ static function create( $row = array() ) { if ( !isset( $row[contentobject_id] ) ) eZDebug::writeError( Missing contentobject_id parameter!, __METHOD__ );! Presenter: André Rømcke ! 09/04/12 5
  6. 6. Architecture of eZ Publish 5.xBefore we begin..! Presenter: André Rømcke ! 09/04/12 6
  7. 7. First: A warning!eZ Publish 5.0 is still in heavy development until October, so:  Concepts might still change somewhat  Code examples will break  Several unit tests are still failing, and lots are still skipped/ incomplete  Documentation is not by any means polished or complete yet  Note: Come by eZ Conference, Köln in October for an updated and refined deep dive into 5.0! Presenter: André Rømcke ! 09/04/12 7
  8. 8. Second: A small 4.x -> 5.x glossary (Content) object Content (Content) class Content Type (Content) attribute Field (Content) class attribute Field Definition Data type Field Type Node Location (Content) class group Content Type Group! Presenter: André Rømcke ! 09/04/12 8
  9. 9. Architecture of eZ Publish 5.xFrom top to down! Presenter: André Rømcke ! 09/04/12 9
  10. 10. Architecture of eZ Publish 5.x: Bird-eye view! Presenter: André Rømcke ! 09/04/12 10
  11. 11. Architecture of eZ Publish 5.x: GIT organization  eZ Publish 5.x meta repository: − https://github.com/ezsystems/ezpublish5 − eZ Publish 5.x Core: https://github.com/ezsystems/ezp-next − eZ Publish 4.x “LS” repository: https://github.com/ezsystems/ezpublish! Presenter: André Rømcke ! 09/04/12 11
  12. 12. Architecture of eZ Publish 5.x: ezsystems/ezpublish5appsrcvendor  composer  doctrine  ezsystems − ezpublish <- This is “ezp-next“ at them moment  symfony  twig  zetacomponentsweb! Presenter: André Rømcke ! 09/04/12 12
  13. 13. Architecture of eZ Publish 5.x: ezsystems/ezp-nextdoceZ  Publish − API − Core − SPIsettingsvendor! Presenter: André Rømcke ! 09/04/12 13
  14. 14. Architecture of eZ Publish 5.xUsing eZ Publish 5! Presenter: André Rømcke ! 09/04/12 14
  15. 15. Using eZ Publish 5.x: Public APIInterfaces & abstracts  Documents the API  Makes it possible to “hide” ImplementationTested with “integration tests”  Code examples generated based on theseLong life cycle  Conservative deprecation -> removal process! Presenter: André Rømcke ! 09/04/12 15
  16. 16. Using eZ Publish 5.x: Public API <Concepts>Separation of concern  Layered architecture  Implies use of Dependency injectionDomain driven design  API gives you a repository consistent of: − Domain Services, with: − Methods for all operations you can perform on a domain (Section, Location, Content, Language, ... ) − Loaded Domain objects are Value objects, hence immutable − Factory methods to create new create/ update “structs” for changing data! Presenter: André Rømcke ! 09/04/12 16
  17. 17. Using eZ Publish 5.x: Public API <Concepts> By code example #1Instead of:public function viewLocation( $locationId, $viewType ){ // Permission check (usually w/o limitations) if ( !$this->user->hasAccessTO( ... ) ) { .... } // Fetch using hard coupling on the “Service” to get a node $location = eZContentObjectTreeNode::fetch( $locationId ); // if $location is null handle error { ... } // Trigger workflow { ... } // Generate view and view cache { ... }}! Presenter: André Rømcke ! 09/04/12 17
  18. 18. Using eZ Publish 5.x: Public API <Concepts> By code example #2It would become:public function viewLocation( $locationId, $viewType ){ // Get location (checks permissions, service proxies can optionally handle cache/events/workflow) $location = $this->repository->getLocationService()->loadLocation( $locationId ); // Execute View, which generates Response, which is cached by Symfony / Varnish}! Presenter: André Rømcke ! 09/04/12 18
  19. 19. Architecture of eZ Publish 5.xExtending eZ Publish 5! Presenter: André Rømcke ! 09/04/12 19
  20. 20. Extending eZ Publish 5.x: SPI’s Service Provider Interface Just like the API a bunch of Interfaces & abstracts  Documents the SPI’s  A contract for how the handlers should be implementedThe “Handlers” of eZ Publish 5.x  Persistence  IO  Limitations  FieldTypes  ...! Presenter: André Rømcke ! 09/04/12 20
  21. 21. Architecture of eZ Publish 5.xHacking eZ Publish 5! Presenter: André Rømcke ! 09/04/12 21
  22. 22. Hacking eZ Publish 5: Core“Kernel” implementation of API and SPI’sTo be considered private  Classes should not be used directly from this namespace if outside  Methods exposed here but not in API or SPI’s are by definition private  Can be re-factored at any given timeUses dependency injection so it is possible to inject alternative implementations of almost anything! Presenter: André Rømcke ! 09/04/12 22
  23. 23. Hacking eZ Publish 5: Core Contains #1FieldType (SPI)IO (SPI)  Legacy (4.x compatibility, uses eZClusterHandler)  InMemory (unit testing)Limitation (SPI)MVC  Legacy (Wrapper for 4.x kernel and functionality)  Symfony (“5.x” kernel, extensions for Symfony Framework)! Presenter: André Rømcke ! 09/04/12 23
  24. 24. Hacking eZ Publish 5: Core Contains #2Persistence (SPI)  Legacy (4.x compatibility, uses 4.x DB schema)  InMemory (unit testing)  Solr (future Search handler)Repository (APIRepository)REST  Client  Serversettings! Presenter: André Rømcke ! 09/04/12 24
  25. 25. Hacking eZ Publish 5: CorePersistenceLegacyUses Zeta Database Component  In the future it could use Doctrine DBALConsists of 3 parts in all handlers  The Domain specific handler  Gateway which deals with the SQL  Mapper which maps sql data to SPI value objects, & back! Presenter: André Rømcke ! 09/04/12 25
  26. 26. Hacking eZ Publish 5: CoreMVC“HMVC”  Using Symfony’s http centric request & response frameworkA Legacy implementation that wraps around 4.x(More on this Thursday)! Presenter: André Rømcke ! 09/04/12 26
  27. 27. Architecture of eZ Publish 5.xLast words..! Presenter: André Rømcke ! 09/04/12 27
  28. 28. Missing features in 5.x stack in 5.0Info collectorsWorkflowNotificationsGUI’s  Admin & Front end editing (available via LS though)Performance (as of 5.0-alpha1)  Full potential not reached, but comparable to 4.xScalability (as of 5.0)  New Persistence & IO handlers needed to reach full potential! Presenter: André Rømcke ! 09/04/12 28
  29. 29. Use cases 5.0 can be used forPossible with pure 5.x stack:  Content repository via REST/Public API  Websites w/o user generated contentWith use of LegacyStack fallback:  Websites with user generated content  Info collector  ...  anything! Presenter: André Rømcke ! 09/04/12 29
  30. 30. Coding example<?php/** * Get a Container pre configured with settings (script should be executed from “ezp-next” root) * @var eZPublishAPIContainer $container This is all you need to get code completion */$container = require(bootstrap.php);// Get Repository & log in as admin (for permissions to create content)$repository = $container->getRepository();$repository->setCurrentUser( $repository->getUserService()->loadUser( 14 ) );// Get Blog ContentType (aka content class)$contentTypeService = $repo->getContentTypeService();$blogContentType = $contentTypeService->loadContentTypeByIdentifier( "blog" );// Create Content struct & Location (node) struct with parent id = 2$contentService = $repository->getContentService();$contentCreateStruct = $contentService->newContentCreateStruct( $blogContentType, "eng-GB" );$contentCreateStruct->setField( "name", "Hello world" );$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( 2 );// Create both structs in db with createContent()$content = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) ); ! Presenter: André Rømcke ! 09/04/12 30
  31. 31. Links for getting started on CodingSome resources:  http://confluence.ez.no/display/EZP  https://github.com/ezsystems/ezp-next/wiki/codingstandardsCode examples  By Petar: https://gist.github.com/pspanja  By Gaetano: https://gist.github.com/gggeek  Generated from all integration tests: http://t.co/mHTqC8bAFollow up talk on FieldTypes:  http://t.co/zSpdVwdHGetting started on Symfony stack:  See GETTING_STARTED in ezpublish5 repo & confluence! Presenter: André Rømcke ! 09/04/12 31

×