SlideShare uma empresa Scribd logo
1 de 17
38. Magento-Meetup Wien
Ivan Cuk
Software Developer
From Core to Custom
A Deep Dive into Magento Entity Extension
What is a Magento Entity?
● Entity is data item (customer, product, order & more)
● Each item has its attributes and values for them
● Represented with one main entity database table (and few other tables)
Why this topic?
● Extending core entities is frequently needed for
customizations
● Important for the stability, modularity, upgradability
and overall quality of the Magento Store
● Different approaches (even within same teams)
Magento core entities
EAV Not EAV
customer order
customer_address invoice
catalog_category creditmemo
catalog_product shipment
EAV available with some entities, Extension Attributes with all entities
The Problem
When to use EAV and when to use Extension Attributes?
How to properly implement Extension Attributes and why
is that important?
Often seen approaches
Developers tend to some of the following things:
● Not use Extension Attributes at all: use a (hacky)
workaround
● Implement Extension Attributes almost always: EAV
capabilities are getting heavily overlooked
EAV Attributes
Basic EAV Attributes can be developed quickly.
No-brainer situation:
Attributes that have simple scalar values.
Example: a custom ERP-ID attribute for the customer
entity
EAV Attributes
Often overlooked: EAV Attributes can be also used for
more complex data-processing and functionalities.
EAV-Models:
attribute_model - overall behaviour
backend_model - before and after attribute save
frontend_model - data representation
source_model - retrieving set of choices
Extension Attributes
When?
● Entity without EAV
● The complexity of the new custom attributes requires
even more flexibility than what EAV offers
Extension Attributes
Advantages
● Unlimited flexibility
● Data saved in its own new tables
Extension Attributes
Disadvantage
● Implementation is can be complex and time consuming
● Some developers turn to hacking the core-tables as an
alternative
Modifying Core Tables?
● Not recommended - source:
https://experienceleague.adobe.com/docs/commerce-
operations/implementation-playbook/best-
practices/development/modifying-core-and-third-party-tables.html?lang=en
● Decreases upgradability & stability of the project
● Underlying logic contains raw SQL queries - can cause side effects difficult to
troubleshoot
● Changes can cause performance problems
● 3rd party modules expect standard core tables
● Standard ways are safer:
● With EAV-Attributes we are not changing DB-structure
● Extension Attributes have their own tables
Modifying Core Tables?
● We are using or relying on directly the implementation (model) classes
instead of Service Contracts
● Example: $model->getData('erp_id');
Service Contracts > Implementations
Extension Attributes
Not always used feature of extension attributes that can accelerate development:
● Join directives
Extension Attributes
Not always used feature of extension attributes that can accelerate development:
● Join directives
Conclusion
● Requirements & custom attributes
● The right implementation
● Full potential of the EAV attributes
● All features of the Extension Attributes
● Avoid hacky solutions when possible

Mais conteúdo relacionado

Semelhante a 38. Magento Meetup Austria: Ivan Cuk - From Core to Custom. A Deep Dive into Magento Entity Extension

Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Codecamp Romania
 
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
PostgresOpen
 
Vandana Sathish Maller
Vandana Sathish MallerVandana Sathish Maller
Vandana Sathish Maller
Vandana Maller
 

Semelhante a 38. Magento Meetup Austria: Ivan Cuk - From Core to Custom. A Deep Dive into Magento Entity Extension (20)

presentation
presentationpresentation
presentation
 
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
 
Business Intelligence Software Comparison 2021
Business Intelligence Software Comparison 2021Business Intelligence Software Comparison 2021
Business Intelligence Software Comparison 2021
 
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...Selena Deckelmann - Sane Schema Management with  Alembic and SQLAlchemy @ Pos...
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
Spring batch overivew
Spring batch overivewSpring batch overivew
Spring batch overivew
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2Madison PHP - Getting Started with Magento 2
Madison PHP - Getting Started with Magento 2
 
Vandana Sathish Maller
Vandana Sathish MallerVandana Sathish Maller
Vandana Sathish Maller
 
2 dirk vermeylen - modeling with neo4 j
2   dirk vermeylen - modeling with neo4 j2   dirk vermeylen - modeling with neo4 j
2 dirk vermeylen - modeling with neo4 j
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Testing lightning components feb 15th 2018
Testing lightning components feb 15th 2018Testing lightning components feb 15th 2018
Testing lightning components feb 15th 2018
 
Improving the Traceability and Reliability of CRM Implementations with TFS
Improving the Traceability and Reliability of CRM Implementations with TFSImproving the Traceability and Reliability of CRM Implementations with TFS
Improving the Traceability and Reliability of CRM Implementations with TFS
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
Framework Enabling End-Users to Maintain Web Applications (ICICWS2015)
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara Anjargolian
 
Agile collaborative practices
Agile collaborative practicesAgile collaborative practices
Agile collaborative practices
 

Mais de Magento Meetup Austria

Mais de Magento Meetup Austria (11)

31. Magento Meetup Austria: News
31. Magento Meetup Austria: News31. Magento Meetup Austria: News
31. Magento Meetup Austria: News
 
30. Magento Meetup Austria: News
30. Magento Meetup Austria: News30. Magento Meetup Austria: News
30. Magento Meetup Austria: News
 
29. Magento Meetup - Why the hell did I choose Magento 2?
29. Magento Meetup - Why the hell did I choose Magento 2?29. Magento Meetup - Why the hell did I choose Magento 2?
29. Magento Meetup - Why the hell did I choose Magento 2?
 
29. Magento Meetup - Datareporter
29. Magento Meetup - Datareporter29. Magento Meetup - Datareporter
29. Magento Meetup - Datareporter
 
29. Magento Meetup Austria: News
29. Magento Meetup Austria: News29. Magento Meetup Austria: News
29. Magento Meetup Austria: News
 
28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento News28. Magento Meetup Austria: Magento News
28. Magento Meetup Austria: Magento News
 
27. Magento Meetup Austria: Magento News & Magento Live Europe 2018 Recap
27. Magento Meetup Austria: Magento News & Magento Live Europe 2018 Recap27. Magento Meetup Austria: Magento News & Magento Live Europe 2018 Recap
27. Magento Meetup Austria: Magento News & Magento Live Europe 2018 Recap
 
27. Magento Meetup Austria: Intro
27. Magento Meetup Austria: Intro27. Magento Meetup Austria: Intro
27. Magento Meetup Austria: Intro
 
26. Magento Meetup Austria: Magento News
26. Magento Meetup Austria: Magento News26. Magento Meetup Austria: Magento News
26. Magento Meetup Austria: Magento News
 
26. Magento Meetup Austria: Intro
26. Magento Meetup Austria: Intro26. Magento Meetup Austria: Intro
26. Magento Meetup Austria: Intro
 
Magento-News @ Magento Meetup Austria 21 (29.05.2017)
Magento-News @ Magento Meetup Austria 21 (29.05.2017)Magento-News @ Magento Meetup Austria 21 (29.05.2017)
Magento-News @ Magento Meetup Austria 21 (29.05.2017)
 

Último

Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
ChloeMeadows1
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
lolsDocherty
 

Último (17)

Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
Reggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirtsReggie miller choke t shirts
Reggie miller choke t shirtsReggie miller choke t shirts
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
I’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 ShirtI’ll See Y’All Motherfuckers In Game 7 Shirt
I’ll See Y’All Motherfuckers In Game 7 Shirt
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 
Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
GOOGLE Io 2024 At takes center stage.pdf
GOOGLE Io 2024 At takes center stage.pdfGOOGLE Io 2024 At takes center stage.pdf
GOOGLE Io 2024 At takes center stage.pdf
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
Development Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of appsDevelopment Lifecycle.pptx for the secure development of apps
Development Lifecycle.pptx for the secure development of apps
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
Free scottie t shirts Free scottie t shirts
Free scottie t shirts Free scottie t shirtsFree scottie t shirts Free scottie t shirts
Free scottie t shirts Free scottie t shirts
 
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWebiThome_CYBERSEC2024_Drive_Into_the_DarkWeb
iThome_CYBERSEC2024_Drive_Into_the_DarkWeb
 
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
TORTOGEL TELAH MENJADI SALAH SATU PLATFORM PERMAINAN PALING FAVORIT.
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 
Thank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirtsThank You Luv I’ll Never Walk Alone Again T shirts
Thank You Luv I’ll Never Walk Alone Again T shirts
 

38. Magento Meetup Austria: Ivan Cuk - From Core to Custom. A Deep Dive into Magento Entity Extension

  • 1. 38. Magento-Meetup Wien Ivan Cuk Software Developer From Core to Custom A Deep Dive into Magento Entity Extension
  • 2. What is a Magento Entity? ● Entity is data item (customer, product, order & more) ● Each item has its attributes and values for them ● Represented with one main entity database table (and few other tables)
  • 3. Why this topic? ● Extending core entities is frequently needed for customizations ● Important for the stability, modularity, upgradability and overall quality of the Magento Store ● Different approaches (even within same teams)
  • 4. Magento core entities EAV Not EAV customer order customer_address invoice catalog_category creditmemo catalog_product shipment EAV available with some entities, Extension Attributes with all entities
  • 5. The Problem When to use EAV and when to use Extension Attributes? How to properly implement Extension Attributes and why is that important?
  • 6. Often seen approaches Developers tend to some of the following things: ● Not use Extension Attributes at all: use a (hacky) workaround ● Implement Extension Attributes almost always: EAV capabilities are getting heavily overlooked
  • 7. EAV Attributes Basic EAV Attributes can be developed quickly. No-brainer situation: Attributes that have simple scalar values. Example: a custom ERP-ID attribute for the customer entity
  • 8. EAV Attributes Often overlooked: EAV Attributes can be also used for more complex data-processing and functionalities. EAV-Models: attribute_model - overall behaviour backend_model - before and after attribute save frontend_model - data representation source_model - retrieving set of choices
  • 9. Extension Attributes When? ● Entity without EAV ● The complexity of the new custom attributes requires even more flexibility than what EAV offers
  • 10. Extension Attributes Advantages ● Unlimited flexibility ● Data saved in its own new tables
  • 11. Extension Attributes Disadvantage ● Implementation is can be complex and time consuming ● Some developers turn to hacking the core-tables as an alternative
  • 12. Modifying Core Tables? ● Not recommended - source: https://experienceleague.adobe.com/docs/commerce- operations/implementation-playbook/best- practices/development/modifying-core-and-third-party-tables.html?lang=en ● Decreases upgradability & stability of the project ● Underlying logic contains raw SQL queries - can cause side effects difficult to troubleshoot ● Changes can cause performance problems ● 3rd party modules expect standard core tables ● Standard ways are safer: ● With EAV-Attributes we are not changing DB-structure ● Extension Attributes have their own tables
  • 13. Modifying Core Tables? ● We are using or relying on directly the implementation (model) classes instead of Service Contracts ● Example: $model->getData('erp_id');
  • 14. Service Contracts > Implementations
  • 15. Extension Attributes Not always used feature of extension attributes that can accelerate development: ● Join directives
  • 16. Extension Attributes Not always used feature of extension attributes that can accelerate development: ● Join directives
  • 17. Conclusion ● Requirements & custom attributes ● The right implementation ● Full potential of the EAV attributes ● All features of the Extension Attributes ● Avoid hacky solutions when possible