SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Design patterns in
Magento
MVC - Model View Controller
3
• Division into 3 main parts
of the application:
• Model - represents the
application logic
• View - describes how to
display data within the
user interface
• Controller - accepts input
from the user, updates the
model and refreshes the
view
MVC
MVC
MVC in MVC
The view layer in Magento itself
implements the MVC pattern.
M - blocks
V - templates.phtml
C – layouts (.xml files)
MVC in MVC
In xml files we define the blocks, which
are part of the view for a given controller
action and assign the appropriate
template to the main block
present the data obtained from the
block
load and render the layout
download data from the model layer, process it
and send to the template
Modularity
8
• Patterns orders grouping
of individual functions in
the project into modules
• Modules should not
require other modules for
proper operation
• Patterns define the
directory structure within
the parent module
directory
Modularity
9
• Magento autoloader has
pre-established search
priorities
• Subdirectory structure is
not only a matter of
convention.
• Magento class name
reflects its path
• The individual components
of the Module must be
explicitly declared the
module configuration file
Modularity in Magento
code pools
Subdirectory structure
in the module’s main
directory
1
A short digression - Autoloader
Code pools are added in a pre-
defined order
set up php of our path of attaching files
registering the autoloader
1
A short digression - Autoloader
The autoloader is called upon class instantiation, unless there is already an object of a
given class in the memory - the file is already attached
note that this is not a built-in
implementation of __autoload () method
Attach the desired file
Factory method in
Magento
1
Factory method in Magento
by the way - Singleton pattern in Magento

1
Factory method in Magento
1
What's under the hood?
we can also create a
class object by giving
its name
1
What's under the hood?
.....
divide the string of characters
first, look for overwritten classes
1
What's under the hood?
Magento adds a ‘mage' prefix as a
namespace
Registry
Registry
It allows you to place
objects and data in the global
pool, allowing access to them
from anywhere in the code
2
Registry
If you call a method with graceful parameter set to true,
you can avoid the occurence of an exception informing
you that there is a value under the given key
if at a given index there is an object that has a
destructor, use it
Event/Observer
2
Event/Observer
The extension code for the
Magento core is located
entirely in the Observer
class
2
How can you add your own observer?
events node
name of the event
module name/class name
name of the calling method at
the event
unique observer ID
2
Event/Observer
calls the appropriate method
2
Event/Observer
Object $area represents certain parts of
the application (frontend, global, admin,
adminhtml)
download the configuration of events for
each part of the application
iterate through all observers for a given
part of the application
Assign a taable of observers to a table of
events under the key of an event name
that they are observing
2
Event/Observer
for each of the observers we try to call its
event operating procedures
assign the observer the
arguments transferred in the
event call
the function calling the observer’s method
call the method by transferring the observer’s
object with the arguments submitted earlier
Front controller
Front controller
It is the entrance gate for all
requests directed at the
running applications..
It consists of two parts:
• web handler - parses the
URL and determines which
controller is to be created
• command dispatch -
creates a controller and
forwards the request
2
Magento Front controller
our candidate 
3
The front controller is designed to
accept a request and decide what
to do with it. Does it all really
happen in the index.php file?
Is that so?
3
What's under the hood?
What have we here?
Get front controller
Call
Call
3
What's under the hood?
Iterate through router info table
containing the name of the router class
and its place of operation (frontend,
admin)
add the created router to the variable
_routers by the method addRouter (). We
will use them in the near future
also a default router is created and added
3
What's under the hood?
Use the completed _routers table
We adapt the request to the router. Match is a
method of the abstract class
Mage_Core_Controller_Varien_Router_Abstract,
so each router defines its own body of this
method
In the match() method, check if the request matches
the address of the router and, if so, transfer the request
to the target module controller
Send an answer to the http client
Prototype
Prototype
The Prototype pattern is a kind
of extension of the abstract
factory pattern. Since it hasn’t
been discussed, it will be briefly
described below
A short digression – abstract facory
It defines a set of factory classes that inherit
from the abstract parent class (factory), which
specialize in creating groups of objects from
one family.
3
It all becomes clear
Prototype
It is a variation of abstract
factory pattern
It helps to limit the number of
factories by creating a generic
factory which is sent the types
of objects to be produced
Prototype
3
Prototyp w Magento
4
the facory method is called and
we transfer a product object as a
parameter
Prototyp w Magento
4
download type id transferred in the
product parameter
from the type table and corresponding names of
model classes we download the one correct for
our product
concretize object type of a product and set up the
product to operate on
There are more design
patterns in Magento, I
strongly encourage you
to explore them 
Thank you for attention
Contact
sales@divante.co

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Sharing and setting in salesforce
Sharing and setting in salesforceSharing and setting in salesforce
Sharing and setting in salesforce
 
Salesforce complete overview
Salesforce complete overviewSalesforce complete overview
Salesforce complete overview
 
Data Management and Migration in Salesforce
Data Management and Migration in SalesforceData Management and Migration in Salesforce
Data Management and Migration in Salesforce
 
(STG401) Amazon S3 Deep Dive & Best Practices
(STG401) Amazon S3 Deep Dive & Best Practices(STG401) Amazon S3 Deep Dive & Best Practices
(STG401) Amazon S3 Deep Dive & Best Practices
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Enterprise Integration - Solution Patterns From the Field
Enterprise Integration - Solution Patterns From the FieldEnterprise Integration - Solution Patterns From the Field
Enterprise Integration - Solution Patterns From the Field
 
Middleware in Asp.Net Core
Middleware in Asp.Net CoreMiddleware in Asp.Net Core
Middleware in Asp.Net Core
 
Salesforce admin training 1
Salesforce admin training 1Salesforce admin training 1
Salesforce admin training 1
 
Getting started with share point online modernization - SharePoint Saturday T...
Getting started with share point online modernization - SharePoint Saturday T...Getting started with share point online modernization - SharePoint Saturday T...
Getting started with share point online modernization - SharePoint Saturday T...
 
Tips for salesforce einstein bot configuration !
Tips for salesforce einstein bot configuration !Tips for salesforce einstein bot configuration !
Tips for salesforce einstein bot configuration !
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
AWS Systems Manager
AWS Systems ManagerAWS Systems Manager
AWS Systems Manager
 
Amazon Virtual Private Cloud (VPC)
Amazon Virtual Private Cloud (VPC)Amazon Virtual Private Cloud (VPC)
Amazon Virtual Private Cloud (VPC)
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern Overview
 
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
Architecting Multitenant SaaS Applications with Azure - Microsoft Ignite The ...
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Introduction to the Salesforce Security Model
Introduction to the Salesforce Security ModelIntroduction to the Salesforce Security Model
Introduction to the Salesforce Security Model
 
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPantherApex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
 

Andere mochten auch

Andere mochten auch (20)

Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)Magento scalability from the trenches (Meet Magento Sweden 2016)
Magento scalability from the trenches (Meet Magento Sweden 2016)
 
Surprising failure factors when implementing eCommerce and Omnichannel eBusiness
Surprising failure factors when implementing eCommerce and Omnichannel eBusinessSurprising failure factors when implementing eCommerce and Omnichannel eBusiness
Surprising failure factors when implementing eCommerce and Omnichannel eBusiness
 
Omnichannel Customer Experience
Omnichannel Customer ExperienceOmnichannel Customer Experience
Omnichannel Customer Experience
 
Magento 2 Workflows
Magento 2 WorkflowsMagento 2 Workflows
Magento 2 Workflows
 
2017 ecommerce design trends
2017 ecommerce design trends2017 ecommerce design trends
2017 ecommerce design trends
 
How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]How to Install Magento 2 [Latest Version]
How to Install Magento 2 [Latest Version]
 
20 Tips to Improve Sales on your Ecommerce Site
20 Tips to Improve Sales on your Ecommerce Site20 Tips to Improve Sales on your Ecommerce Site
20 Tips to Improve Sales on your Ecommerce Site
 
E-Commerce Technology
E-Commerce TechnologyE-Commerce Technology
E-Commerce Technology
 
Magento implementation - by Divante.co
Magento implementation - by Divante.coMagento implementation - by Divante.co
Magento implementation - by Divante.co
 
E-Commerce Case Studies
E-Commerce Case StudiesE-Commerce Case Studies
E-Commerce Case Studies
 
2017 Social Media & Content Marketing Predictions from 70 Marketing Leaders
2017 Social Media & Content Marketing Predictions from 70 Marketing Leaders 2017 Social Media & Content Marketing Predictions from 70 Marketing Leaders
2017 Social Media & Content Marketing Predictions from 70 Marketing Leaders
 
E-commerce Trends from 2015 to 2016 by Divante
E-commerce Trends from 2015 to 2016 by DivanteE-commerce Trends from 2015 to 2016 by Divante
E-commerce Trends from 2015 to 2016 by Divante
 
Digital marketing Trends 2017
Digital marketing Trends 2017Digital marketing Trends 2017
Digital marketing Trends 2017
 
SEO for Ecommerce: A Comprehensive Guide
SEO for Ecommerce: A Comprehensive GuideSEO for Ecommerce: A Comprehensive Guide
SEO for Ecommerce: A Comprehensive Guide
 
Digital Marketing Trends 2017
Digital Marketing Trends 2017Digital Marketing Trends 2017
Digital Marketing Trends 2017
 
Social Media Trends 2017
Social Media Trends 2017Social Media Trends 2017
Social Media Trends 2017
 
Digital Trends in 2017: Making Business Impact in a Changing World
Digital Trends in 2017: Making Business Impact in a Changing WorldDigital Trends in 2017: Making Business Impact in a Changing World
Digital Trends in 2017: Making Business Impact in a Changing World
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5Go OO! - Real-life Design Patterns in PHP 5
Go OO! - Real-life Design Patterns in PHP 5
 
OroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM from a developer's perspectiveOroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM from a developer's perspective
 

Ähnlich wie Design patterns in Magento

Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2
Santosh Singh Paliwal
 

Ähnlich wie Design patterns in Magento (20)

Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]ASP.Net MVC 4 [Part - 2]
ASP.Net MVC 4 [Part - 2]
 
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Struts Ppt 1
Struts Ppt 1Struts Ppt 1
Struts Ppt 1
 
Struts N E W
Struts N E WStruts N E W
Struts N E W
 
Master a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptxMaster a Cloud Native Standard - MicroProfile.pptx
Master a Cloud Native Standard - MicroProfile.pptx
 
Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...
 
Struts
StrutsStruts
Struts
 
Unit 2
Unit 2Unit 2
Unit 2
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
systemverilog-interview-questions.docx
systemverilog-interview-questions.docxsystemverilog-interview-questions.docx
systemverilog-interview-questions.docx
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Net framework session03
Net framework session03Net framework session03
Net framework session03
 
Unit 1
Unit  1Unit  1
Unit 1
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
 
What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2What is the difference between struts 1 vs struts 2
What is the difference between struts 1 vs struts 2
 
MVC
MVCMVC
MVC
 
Building enterprise web applications with spring 3
Building enterprise web applications with spring 3Building enterprise web applications with spring 3
Building enterprise web applications with spring 3
 

Mehr von Divante

eCommerce trends 2019 by Divante.co
eCommerce trends 2019 by Divante.coeCommerce trends 2019 by Divante.co
eCommerce trends 2019 by Divante.co
Divante
 

Mehr von Divante (20)

The eCommerce Platforms in the Global Setup
The eCommerce Platforms in the Global Setup	The eCommerce Platforms in the Global Setup
The eCommerce Platforms in the Global Setup
 
eCommerce Trends 2020
eCommerce Trends 2020eCommerce Trends 2020
eCommerce Trends 2020
 
Async & Bulk REST API new possibilities of communication between systems
Async & Bulk REST API new possibilities of communication  between systemsAsync & Bulk REST API new possibilities of communication  between systems
Async & Bulk REST API new possibilities of communication between systems
 
Magento Functional Testing Framework a way to seriously write automated tests...
Magento Functional Testing Framework a way to seriously write automated tests...Magento Functional Testing Framework a way to seriously write automated tests...
Magento Functional Testing Framework a way to seriously write automated tests...
 
Die Top 10 Progressive Web Apps in der Modernbranche
Die Top 10 Progressive Web Apps in der ModernbrancheDie Top 10 Progressive Web Apps in der Modernbranche
Die Top 10 Progressive Web Apps in der Modernbranche
 
progressive web apps - pwa as a game changer for e-commerce - meet magento i...
 progressive web apps - pwa as a game changer for e-commerce - meet magento i... progressive web apps - pwa as a game changer for e-commerce - meet magento i...
progressive web apps - pwa as a game changer for e-commerce - meet magento i...
 
Customer churn - how to stop it?
Customer churn - how to stop it?Customer churn - how to stop it?
Customer churn - how to stop it?
 
eCommerce trends 2019 by Divante.co
eCommerce trends 2019 by Divante.coeCommerce trends 2019 by Divante.co
eCommerce trends 2019 by Divante.co
 
How to create a Vue Storefront theme
How to create a Vue Storefront themeHow to create a Vue Storefront theme
How to create a Vue Storefront theme
 
Game changer for e-commerce - Vue Storefront - open source pwa
Game changer for e-commerce - Vue Storefront - open source pwa Game changer for e-commerce - Vue Storefront - open source pwa
Game changer for e-commerce - Vue Storefront - open source pwa
 
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speechVue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
Vue Storefront - Progressive Web App for Magento (1.9, 2.x) - MM18DE speech
 
How to successfully onboard end-clients to a B2B Platform - Magento Imagine ...
How to successfully onboard  end-clients to a B2B Platform - Magento Imagine ...How to successfully onboard  end-clients to a B2B Platform - Magento Imagine ...
How to successfully onboard end-clients to a B2B Platform - Magento Imagine ...
 
eCommerce trends from 2017 to 2018 by Divante.co
eCommerce trends from 2017 to 2018 by Divante.coeCommerce trends from 2017 to 2018 by Divante.co
eCommerce trends from 2017 to 2018 by Divante.co
 
Designing for PWA (Progressive Web Apps)
Designing for PWA (Progressive Web Apps)Designing for PWA (Progressive Web Apps)
Designing for PWA (Progressive Web Apps)
 
Why is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenariosWhy is crud a bad idea - focus on real scenarios
Why is crud a bad idea - focus on real scenarios
 
vue-storefront - PWA eCommerce for Magento2 MM17NYC presentation
vue-storefront - PWA eCommerce for Magento2 MM17NYC presentationvue-storefront - PWA eCommerce for Magento2 MM17NYC presentation
vue-storefront - PWA eCommerce for Magento2 MM17NYC presentation
 
Pimcore Overview - Pimcore5
Pimcore Overview - Pimcore5Pimcore Overview - Pimcore5
Pimcore Overview - Pimcore5
 
Pimcore E-Commerce Framework - Pimcore5
Pimcore E-Commerce Framework - Pimcore5Pimcore E-Commerce Framework - Pimcore5
Pimcore E-Commerce Framework - Pimcore5
 
The biggest stores on Magento
The biggest stores on MagentoThe biggest stores on Magento
The biggest stores on Magento
 
B2B Commerce - how to become successful
B2B Commerce - how to become successfulB2B Commerce - how to become successful
B2B Commerce - how to become successful
 

Kürzlich hochgeladen

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
 
+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@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
+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...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Design patterns in Magento

  • 2. MVC - Model View Controller
  • 3. 3 • Division into 3 main parts of the application: • Model - represents the application logic • View - describes how to display data within the user interface • Controller - accepts input from the user, updates the model and refreshes the view MVC
  • 4. MVC
  • 5. MVC in MVC The view layer in Magento itself implements the MVC pattern. M - blocks V - templates.phtml C – layouts (.xml files)
  • 6. MVC in MVC In xml files we define the blocks, which are part of the view for a given controller action and assign the appropriate template to the main block present the data obtained from the block load and render the layout download data from the model layer, process it and send to the template
  • 8. 8 • Patterns orders grouping of individual functions in the project into modules • Modules should not require other modules for proper operation • Patterns define the directory structure within the parent module directory Modularity
  • 9. 9 • Magento autoloader has pre-established search priorities • Subdirectory structure is not only a matter of convention. • Magento class name reflects its path • The individual components of the Module must be explicitly declared the module configuration file Modularity in Magento code pools Subdirectory structure in the module’s main directory
  • 10. 1 A short digression - Autoloader Code pools are added in a pre- defined order set up php of our path of attaching files registering the autoloader
  • 11. 1 A short digression - Autoloader The autoloader is called upon class instantiation, unless there is already an object of a given class in the memory - the file is already attached note that this is not a built-in implementation of __autoload () method Attach the desired file
  • 13. 1 Factory method in Magento by the way - Singleton pattern in Magento 
  • 15. 1 What's under the hood? we can also create a class object by giving its name
  • 16. 1 What's under the hood? ..... divide the string of characters first, look for overwritten classes
  • 17. 1 What's under the hood? Magento adds a ‘mage' prefix as a namespace
  • 19. Registry It allows you to place objects and data in the global pool, allowing access to them from anywhere in the code
  • 20. 2 Registry If you call a method with graceful parameter set to true, you can avoid the occurence of an exception informing you that there is a value under the given key if at a given index there is an object that has a destructor, use it
  • 22. 2 Event/Observer The extension code for the Magento core is located entirely in the Observer class
  • 23. 2 How can you add your own observer? events node name of the event module name/class name name of the calling method at the event unique observer ID
  • 25. 2 Event/Observer Object $area represents certain parts of the application (frontend, global, admin, adminhtml) download the configuration of events for each part of the application iterate through all observers for a given part of the application Assign a taable of observers to a table of events under the key of an event name that they are observing
  • 26. 2 Event/Observer for each of the observers we try to call its event operating procedures assign the observer the arguments transferred in the event call the function calling the observer’s method call the method by transferring the observer’s object with the arguments submitted earlier
  • 28. Front controller It is the entrance gate for all requests directed at the running applications.. It consists of two parts: • web handler - parses the URL and determines which controller is to be created • command dispatch - creates a controller and forwards the request
  • 30. 3 The front controller is designed to accept a request and decide what to do with it. Does it all really happen in the index.php file? Is that so?
  • 31. 3 What's under the hood? What have we here? Get front controller Call Call
  • 32. 3 What's under the hood? Iterate through router info table containing the name of the router class and its place of operation (frontend, admin) add the created router to the variable _routers by the method addRouter (). We will use them in the near future also a default router is created and added
  • 33. 3 What's under the hood? Use the completed _routers table We adapt the request to the router. Match is a method of the abstract class Mage_Core_Controller_Varien_Router_Abstract, so each router defines its own body of this method In the match() method, check if the request matches the address of the router and, if so, transfer the request to the target module controller Send an answer to the http client
  • 35. Prototype The Prototype pattern is a kind of extension of the abstract factory pattern. Since it hasn’t been discussed, it will be briefly described below
  • 36. A short digression – abstract facory It defines a set of factory classes that inherit from the abstract parent class (factory), which specialize in creating groups of objects from one family.
  • 38. Prototype It is a variation of abstract factory pattern It helps to limit the number of factories by creating a generic factory which is sent the types of objects to be produced
  • 40. Prototyp w Magento 4 the facory method is called and we transfer a product object as a parameter
  • 41. Prototyp w Magento 4 download type id transferred in the product parameter from the type table and corresponding names of model classes we download the one correct for our product concretize object type of a product and set up the product to operate on
  • 42. There are more design patterns in Magento, I strongly encourage you to explore them 
  • 43. Thank you for attention Contact sales@divante.co