SlideShare a Scribd company logo
1 of 12
Download to read offline
It’s all about eXperience
EzobjectWrapper
Workshop
1. Why we needed a wrapper
2. What is ezobjectwrapper ?
3. Hands on exercises
4. Q&A
2
EzobjectWrapper
Workshop
Why we needed a
wrapper
01
● Performance issues when
displaying multiple contents in
the same page with ez_content:
viewLocation
● Rendering rules in classes rather
than repositories/controller
● Listing different content types
with the same HTML code
3
What is
EzobjectWrapper ?
02
● Bundle originally made by
Antonin Savoie, dev@Kaliop
● A wrapper encapsulates content
& location (lazy loading)
● Each wrapper provides its own
methods / business logic
● Factory creates corresponding
wrapper object depending on
content type
● Bonus : renderLocation twig
function
4
Github repos
Titre de la présentation à personnaliser 5
https://github.com/kaliop/ezobjectwrapper
https://github.com/kaliop/ezobjectwrapper-workshop
Encapsulates content & location
Titre de la présentation à personnaliser 6
public function __construct(ContainerInterface $container, $location = null, $content = null)
{
….
$this->location = $location;
$this->content = $content;
}
Lazy loading
Titre de la présentation à personnaliser 7
public function content()
{
if($this->content == null){
$this->content = $this->repository->getContentService()->loadContent($this->location->contentId);
}
return $this->content;
}
EzobjectWrapper factory
Titre de la présentation à personnaliser 8
public function buildeZObjectWrapper($source)
{
$locationSource = null;
$contentSource = null;
if(is_numeric($source)) {
$locationSource = $source = $this->repository->getLocationService()->loadLocation($source);
} elseif($source instanceof Content) {
$contentSource = $source;
} else {
$locationSource = $source;
}
$contentTypeIdentifier = $this->repository->getContentTypeService()->loadContentType($source->contentInfo->contentTypeId)->identifier;
$mappingEntities = $this->container->getParameter('class_mapping');
$defaultClass = $this->container->getParameter('default_ezobject_class');
if(isset($mappingEntities[$contentTypeIdentifier])){
$className = $mappingEntities[$contentTypeIdentifier];
} else {
$className = $defaultClass;
}
$objectWrapper = new $className($this->container, $locationSource, $contentSource);
return $objectWrapper;
}
renderLocation Twig function
Titre de la présentation à personnaliser 9
{{ render( controller( "ez_content:viewLocation", {"locationId": 123, "viewType": "line"} ) ) }}
Before :
{{ renderLocation( 123, "line" )|raw }}
After :
public function renderLocation($locationID, $viewType, $params = array()) {
$rendering = $this->container->get('ezpublish.controller.content.view')->viewLocation($locationID, $viewType, false, $params);
return htmlspecialchars_decode($rendering->getContent());
}
How it works :
Hands on exercises
03 10
Check your ezobjwrapper instance is working
Titre de la présentation à personnaliser 11
$ cd /var/www/summercamp/workshops/ezobjwrapper
$ git pull
$ git checkout step-0
Open http://ezobjwrapper.ezsc in your browser
Q&A
04 12

More Related Content

What's hot

Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
taggg
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVC
Jace Ju
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
benalman
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
Tammy Hart
 

What's hot (20)

Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Adding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer ToolboxAdding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer Toolbox
 
Hands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkHands-on with the Symfony2 Framework
Hands-on with the Symfony2 Framework
 
Development of Ansible modules
Development of Ansible modulesDevelopment of Ansible modules
Development of Ansible modules
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
Effective ES6
Effective ES6Effective ES6
Effective ES6
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVC
 
PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Building Content Types with Dexterity
Building Content Types with DexterityBuilding Content Types with Dexterity
Building Content Types with Dexterity
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
 
xml-motor ~ What,Why,How
xml-motor ~ What,Why,Howxml-motor ~ What,Why,How
xml-motor ~ What,Why,How
 
Sa
SaSa
Sa
 
From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)
 

Viewers also liked

Introducing eZ Publish Platform 5.1 - webinar
Introducing eZ Publish Platform 5.1 - webinarIntroducing eZ Publish Platform 5.1 - webinar
Introducing eZ Publish Platform 5.1 - webinar
Roland Benedetti
 
eZ UnConference - Z Publish top-performance through mastery (and extension) o...
eZ UnConference - Z Publish top-performance through mastery (and extension) o...eZ UnConference - Z Publish top-performance through mastery (and extension) o...
eZ UnConference - Z Publish top-performance through mastery (and extension) o...
Kaliop-slide
 
Building Open Source Identity Management with FreeIPA
Building Open Source Identity Management with FreeIPABuilding Open Source Identity Management with FreeIPA
Building Open Source Identity Management with FreeIPA
LDAPCon
 

Viewers also liked (10)

Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?
 
E z conference 2016 : The Next Generation of Innovative Applications: Powere...
E z conference 2016  : The Next Generation of Innovative Applications: Powere...E z conference 2016  : The Next Generation of Innovative Applications: Powere...
E z conference 2016 : The Next Generation of Innovative Applications: Powere...
 
Introducing eZ Publish Platform 5.1 - webinar
Introducing eZ Publish Platform 5.1 - webinarIntroducing eZ Publish Platform 5.1 - webinar
Introducing eZ Publish Platform 5.1 - webinar
 
eZ Publish Platform 5.4 public webinar
eZ Publish Platform 5.4 public webinareZ Publish Platform 5.4 public webinar
eZ Publish Platform 5.4 public webinar
 
eZ UnConference - Z Publish top-performance through mastery (and extension) o...
eZ UnConference - Z Publish top-performance through mastery (and extension) o...eZ UnConference - Z Publish top-performance through mastery (and extension) o...
eZ UnConference - Z Publish top-performance through mastery (and extension) o...
 
Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?
 
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
 
L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...
 
eZ Publish & Deployment of a multi-site platform
eZ Publish & Deployment of a multi-site platformeZ Publish & Deployment of a multi-site platform
eZ Publish & Deployment of a multi-site platform
 
Building Open Source Identity Management with FreeIPA
Building Open Source Identity Management with FreeIPABuilding Open Source Identity Management with FreeIPA
Building Open Source Identity Management with FreeIPA
 

Similar to Ezobject wrapper workshop

oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
tutorialsruby
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
tutorialsruby
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.com
ayandoesnotemail
 
How to build a production-ready in-memory-based application in 1 hour
How to build a production-ready in-memory-based application in 1 hourHow to build a production-ready in-memory-based application in 1 hour
How to build a production-ready in-memory-based application in 1 hour
Tom Diederich
 

Similar to Ezobject wrapper workshop (20)

Oop in php_tutorial
Oop in php_tutorialOop in php_tutorial
Oop in php_tutorial
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UICustomizing the Presentation Model and Physical Renderer in Siebel Open UI
Customizing the Presentation Model and Physical Renderer in Siebel Open UI
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.com
 
Oop in php tutorial
Oop in php tutorialOop in php tutorial
Oop in php tutorial
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
tutorial54
tutorial54tutorial54
tutorial54
 
tutorial54
tutorial54tutorial54
tutorial54
 
Real World Caching with Ruby on Rails
Real World Caching with Ruby on RailsReal World Caching with Ruby on Rails
Real World Caching with Ruby on Rails
 
l2-es6-160830040119.pdf
l2-es6-160830040119.pdfl2-es6-160830040119.pdf
l2-es6-160830040119.pdf
 
Oop's in php
Oop's in php Oop's in php
Oop's in php
 
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes][HKOSCON][20200613][ Ansible: From VM to Kubernetes]
[HKOSCON][20200613][ Ansible: From VM to Kubernetes]
 
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
最近 node.js 來勢洶洶, 怎麼辦? 別怕, 我們也有秘密武器 RingoJS!
 
How to build a production-ready in-memory-based application in 1 hour
How to build a production-ready in-memory-based application in 1 hourHow to build a production-ready in-memory-based application in 1 hour
How to build a production-ready in-memory-based application in 1 hour
 
Lecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 SlideLecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 Slide
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 

More from Kaliop-slide

LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
Kaliop-slide
 
Redeploiement d’une plateforme eZpublish multisites internationale
Redeploiement d’une plateforme eZpublish multisites internationaleRedeploiement d’une plateforme eZpublish multisites internationale
Redeploiement d’une plateforme eZpublish multisites internationale
Kaliop-slide
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching Mechanisms
Kaliop-slide
 

More from Kaliop-slide (20)

L'agilité au service de l'innovation
L'agilité au service de l'innovationL'agilité au service de l'innovation
L'agilité au service de l'innovation
 
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
 
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimization
 
How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)
 
eZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battleeZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battle
 
Utilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.frUtilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.fr
 
Demystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developersDemystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developers
 
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ PublishWebinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
 
Bien choisir sa solution e-commerce
Bien choisir sa solution e-commerceBien choisir sa solution e-commerce
Bien choisir sa solution e-commerce
 
Webinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourismeWebinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourisme
 
How to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishHow to deploy & optimize eZ Publish
How to deploy & optimize eZ Publish
 
Optimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automationOptimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automation
 
Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)
 
LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
LE RESPONSIVE WEBDESIGN : VOTRE VISIBILITÉ WEB OPTIMALE SUR TOUS LES SUPPORTS...
 
Redeploiement d’une plateforme eZpublish multisites internationale
Redeploiement d’une plateforme eZpublish multisites internationaleRedeploiement d’une plateforme eZpublish multisites internationale
Redeploiement d’une plateforme eZpublish multisites internationale
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching Mechanisms
 
CJW Newsletter
CJW NewsletterCJW Newsletter
CJW Newsletter
 
CHALLENGE Ez On tour, outil de publication web pour le e-tourisme
CHALLENGE Ez On tour, outil de publication web pour le e-tourismeCHALLENGE Ez On tour, outil de publication web pour le e-tourisme
CHALLENGE Ez On tour, outil de publication web pour le e-tourisme
 
L'approche affinitaire : un levier marketing efficace pour les acteurs du e-t...
L'approche affinitaire : un levier marketing efficace pour les acteurs du e-t...L'approche affinitaire : un levier marketing efficace pour les acteurs du e-t...
L'approche affinitaire : un levier marketing efficace pour les acteurs du e-t...
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Ezobject wrapper workshop

  • 1. It’s all about eXperience EzobjectWrapper Workshop
  • 2. 1. Why we needed a wrapper 2. What is ezobjectwrapper ? 3. Hands on exercises 4. Q&A 2 EzobjectWrapper Workshop
  • 3. Why we needed a wrapper 01 ● Performance issues when displaying multiple contents in the same page with ez_content: viewLocation ● Rendering rules in classes rather than repositories/controller ● Listing different content types with the same HTML code 3
  • 4. What is EzobjectWrapper ? 02 ● Bundle originally made by Antonin Savoie, dev@Kaliop ● A wrapper encapsulates content & location (lazy loading) ● Each wrapper provides its own methods / business logic ● Factory creates corresponding wrapper object depending on content type ● Bonus : renderLocation twig function 4
  • 5. Github repos Titre de la présentation à personnaliser 5 https://github.com/kaliop/ezobjectwrapper https://github.com/kaliop/ezobjectwrapper-workshop
  • 6. Encapsulates content & location Titre de la présentation à personnaliser 6 public function __construct(ContainerInterface $container, $location = null, $content = null) { …. $this->location = $location; $this->content = $content; }
  • 7. Lazy loading Titre de la présentation à personnaliser 7 public function content() { if($this->content == null){ $this->content = $this->repository->getContentService()->loadContent($this->location->contentId); } return $this->content; }
  • 8. EzobjectWrapper factory Titre de la présentation à personnaliser 8 public function buildeZObjectWrapper($source) { $locationSource = null; $contentSource = null; if(is_numeric($source)) { $locationSource = $source = $this->repository->getLocationService()->loadLocation($source); } elseif($source instanceof Content) { $contentSource = $source; } else { $locationSource = $source; } $contentTypeIdentifier = $this->repository->getContentTypeService()->loadContentType($source->contentInfo->contentTypeId)->identifier; $mappingEntities = $this->container->getParameter('class_mapping'); $defaultClass = $this->container->getParameter('default_ezobject_class'); if(isset($mappingEntities[$contentTypeIdentifier])){ $className = $mappingEntities[$contentTypeIdentifier]; } else { $className = $defaultClass; } $objectWrapper = new $className($this->container, $locationSource, $contentSource); return $objectWrapper; }
  • 9. renderLocation Twig function Titre de la présentation à personnaliser 9 {{ render( controller( "ez_content:viewLocation", {"locationId": 123, "viewType": "line"} ) ) }} Before : {{ renderLocation( 123, "line" )|raw }} After : public function renderLocation($locationID, $viewType, $params = array()) { $rendering = $this->container->get('ezpublish.controller.content.view')->viewLocation($locationID, $viewType, false, $params); return htmlspecialchars_decode($rendering->getContent()); } How it works :
  • 11. Check your ezobjwrapper instance is working Titre de la présentation à personnaliser 11 $ cd /var/www/summercamp/workshops/ezobjwrapper $ git pull $ git checkout step-0 Open http://ezobjwrapper.ezsc in your browser