Download - eZ Publish nextgen

Transcript
Page 1: eZ Publish nextgen

eZ Publish NextgenKnock knock. Who’s there ? The Future !

samedi 15 octobre 11

Page 2: eZ Publish nextgen

Current  architectureWhat’s  wrong  with  it  ?  Why  ?

samedi 15 octobre 11

Page 3: eZ Publish nextgen

Current  architecture

samedi 15 octobre 11

Page 4: eZ Publish nextgen

• RDBMS  dependent,  and  strongly  bound  to  the  database  structure• PHP  4  ages  legacy  :

o Weak  OOP  concepts  (no  interfaces,  no  abstract,  no  excepGons,  no  magic,  no  dependency  injecGon,  everything  is  public)

o Global  variables  usage  (for  singletons  on  in-­‐memory  cache)o (And  also  some  dirty  workarounds)

• Low  level  APIo Hard  to  catcho SomeGmes  dangerous  to  manipulate  directly  (for  data  integrity)o No  real  API  doc,  hence  no  developer  doc

• Hardly  testable

Current  architecture

samedi 15 octobre 11

Page 5: eZ Publish nextgen

• Evolu'ons  are  very  'me-­‐consuming• Maintaining  backward  compa'bility  is  very  complex• No  possible  support  for  NoSQL• Impossible  to  perform  RDBMS  specific  op'miza'ons  

(na've  func'ons  and  procedures,  like  in  Oracle,  or  even  latest  MySQL)

• Bad  API  usage  (and  "Black  Magic")

Consequences

samedi 15 octobre 11

Page 6: eZ Publish nextgen

New  architecture«This  is  a  revoluGon»  ©  S.J.

samedi 15 octobre 11

Page 7: eZ Publish nextgen

Layers...

samedi 15 octobre 11

Page 8: eZ Publish nextgen

• Kicked  off  with  Domain  Driven  Design  methodologies• Storage  system  agnos'c• Extensible• Secure• Easy  to  use• Modern  (PHP  5.3,  namespaces,  design  paUerns...)

New  architecture  overview

samedi 15 octobre 11

Page 9: eZ Publish nextgen

samedi 15 octobre 11

Page 10: eZ Publish nextgen

The  refined  domain  defini'on  comes  up  with  new  terms:

Content  Object Content

Node Loca/on

Content  Object  A1ribute Field

Content  Class Content  Type

Content  Class  A1ribute Field  Defini/on

Datatype Field  Type

Easier  to  understand  for  newcomers  and  non-­‐technical  people  (Domain  design  approach)

Do  you  speak  eZ  Publish  ?

samedi 15 octobre 11

Page 11: eZ Publish nextgen

• Public  API  is  the  ONLY  API  any  developer  should  use  directly

• Any  developer  =  eZ  Engineers  included  (kernel  modules)

• Should  be  sexy  and  very  easy  to  use

• High  level,  so  that  the  developer  doesn't  care  about  the  backend

• It  interacts  seamlessly  with  the  business  layer  in  the  backend

Public  API

samedi 15 octobre 11

Page 12: eZ Publish nextgen

• This  is  the  layer  where  most  of  the  logic  is  implemented

• It  is  completely  storage  agnos/c,  as  it  uses  the  content  persistence  API.

• It  uses  the  Content  Repository  to  manipulate  the  CMS  data.

• It  doesn't  delegate  logic  to  the  content  persistence  API.

Business  layer

samedi 15 octobre 11

Page 13: eZ Publish nextgen

• Starts  as  a  set  of  interfaces.

• These  interfaces  are  implemented  by  every  content  repositories  (aka  Storage  Engines).

• Ensures  full  abstrac/on  between  the  business  layer  and  the  storage  mechanisms.

• Contains  as  liUle  logic  as  possible.  It  cares  about  data,  only  data.  Logic  is  in  the  business  layer.

Persistence  layer

samedi 15 octobre 11

Page 14: eZ Publish nextgen

• Storage  engines  implement  the  Content  Persistence  Interfaces

• Each  storage  engine  corresponds  to  a  type  of  data  storageo Classic  RDBMS  (MySQL,  PostgreSQL...)o Document  oriented  storage  (NoSQL)o ...

• Internals  are  completely  hidden,  and  can  use  anything:  ORM,  ezcDatabase,  REST,  SOAP...

Storage  engines

samedi 15 octobre 11

Page 15: eZ Publish nextgen

New,  fancy  terms

• Repository:  Centralized,  virtual  storage  system.  Implemented  by  storage.  Also  used  for  binary  files.

• Domain  Object  (aka  DO):  High  level  PHP  object  exposed  in  public  API:  Content,  Loca'on,  Field,  etc.

• Service:  Interac'on  components  from  the  Business  Layer:  Content,  Loca'on,  etc.

Do  you  speak  eZ  Publish  ?

samedi 15 octobre 11

Page 16: eZ Publish nextgen

• eZ  Publish  4  database  Persistence  Layer  implementa'on  

• Implemented  from  scratch.  Shiny  !

• Uses  the  Zeta  Components  (ezcDatabase  +  ezcQuery)

• Tested  to  be  two-­‐ways  compa/ble  with  eZ  Publish  4:➡ content  created  from  ezp4  is  available  in  the  API➡ content  created  from  the  API  is  available  in  ezp4

• No  migra/on  required  !

Legacy  Storage  Engine

samedi 15 octobre 11

Page 17: eZ Publish nextgen

Code  !That’s  why  we’re  here,  right  ?

samedi 15 octobre 11

Page 18: eZ Publish nextgen

samedi 15 octobre 11

Page 19: eZ Publish nextgen

<?phpuse ezp\Base\ServiceContainer,    ezp\Base\Configuration,    ezp\Content\FieldType\Url;

// Get the repository, and configure the user to use$sc = new ServiceContainer( Configuration::getInstance( 'service' )->getAll() );$repository = $sc->getRepository();$contentService = $repository->getContentService();$repository->setUser( $repository->getUserService()->load( 14 ) );

// Build a new folder// $folder will be a DO, ezp\Content$folder = $contentService->init( 'folder', 'eng-GB' );$folder->fields['name'] = 'News';$folder->fields['description'] = '<p>My <strong>ubber cool</strong> description !</p>';$folder->fields['link'] = new Url\Value( 'http://ez.no', 'eZ Systems' );$folder->addParent( $repository->getLocationService()->load( 2 ) );$folder = $contentService->create( $folder );$contentService->publish( $folder->versions[1] );

Create  content

samedi 15 octobre 11

Page 20: eZ Publish nextgen

<?phpuse ezp\Base\ServiceContainer,    ezp\Base\Configuration;

$sc = new ServiceContainer( Configuration::getInstance( 'service' )->getAll() );$repository = $sc->getRepository();$contentService = $repository->getContentService();try{    $content = $contentService->load( 60 );}catch ( ezp\Base\Exception\NotFound $e ){    echo "Content could not be found in the repository !\n";    exit;}

// Loop against fields.// $identifier is the attribute identifier// $value is the corresponding value objectecho "Content '{$content}' has following fields:\n";foreach ( $content->fields as $identifier => $value ){    echo "Field '{$identifier}': {$value}\n"; // Using $value __toString()}

Load  content

samedi 15 octobre 11

Page 21: eZ Publish nextgen

<?phpuse ezp\Base\ServiceContainer,    ezp\Base\Configuration,    ezp\Content,    ezp\Content\Query;

$sc = new ServiceContainer( Configuration::getInstance( 'service' )->getAll() );$qb = new ezp\Content\Query\Builder;$contentService = $sc->getRepository()->getContentService();

// a full criteria$qb->addCriteria(    $qb->fullText->like( 'eZ Publish' ),    $qb->urlAlias->like( '/cms/amazing/*' ),    $qb->contentType->eq( 'blog_post' ),    $qb->field->eq( 'author', '[email protected]' ))->addSortClause(    $qb->sort->field( 'blog_post', 'title', Query::SORT_ASC ),    $qb->sort->dateCreated( Query::SORT_DESC ))->setOffset( 0 )->setLimit( 10 );$contentList = $contentService->find( $qb->getQuery() );

Fetch  content

samedi 15 octobre 11

Page 22: eZ Publish nextgen

Field  types

• Now  spliUed  in  (at  least)  2  objects:• Type• Value

• Dedicated  PHP  namespace

• Interfaces  to  determine  which  features  the  field  type  implement  (Searchable,  Collectable...)

• Converters  for  Legacy  storage  engine

samedi 15 octobre 11

Page 23: eZ Publish nextgen

• Full  language/transla'on  support

• Finish  migra'ng  datatypes

• HTTP  layer  +  modules

• REST  API  implementa'on  based  on  the  new  API

• Op'mized  storage  engines

Roadmap

samedi 15 octobre 11

Page 24: eZ Publish nextgen

•Get it : http://github.com/ezsystems/ezp-next

•Blame it : http://issues.ez.no/ezpublish (ezpnext component)

•Discuss it : http://share.ez.no/forums/new-php-api

•Own it : Make a GitHub pull request !

Soon to come: wiki based cookbook, blog posts.

Now  it’s  your  turn  !

samedi 15 octobre 11


Top Related