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

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

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