SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
Working with OroCRM Entities
Working with OroCRM Entities
Working with OroCRM Entities
Agenda
• Doctrine entity
• Configurable entity
• Extended entity
Working with OroCRM Entities
Doctrine Entity
Working with OroCRM Entities
Overview
Entities are PHP objects that can be identified over many requests by a
unique identifier or primary key. These classes don’t need to extend
any abstract base class or interface. An entity class must not be final or
contain final methods. Additionally it must not implement clone nor
wakeup or do so safely.
An entity contains persistable properties. A persistable property is an
instance variable of the entity that is saved into and retrieved from the
database by Doctrine’s data mapping capabilities.
Doctrine 2 ORM Documentation
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started.
html
Doctrine Entity
Working with OroCRM Entities
How to add Doctrine entity?
● Create PHP Class to represent DB table, e.g.
AcmeBundleHotelBundleEntityHotel
● Use DoctrineORMMapping to add Doctrine
annotation to class
● Create Oro Migration DB tables schema, e.g.
acme_hotel
● Command oro:migration:load
You can find more about Doctrine ORM in the documentation
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html
Doctrine Entity
Working with OroCRM Entities
Oro Migrations
● Bundle defines it’s own tables in the database schema
● Incremental change of database schema is placed in
separate migration class
● Each migration class has it own version
Doctrine Entity
Working with OroCRM Entities
Configurable Entity
Working with OroCRM Entities
Overview and Features
• Two levels of configuration: entity and entity field
• Support of different configuration scopes
• Configuration schema:
BundleName/Resources/config/entity_config.yml
• Access to configuration field values is provided by
services
• Users with the appropriate permissions can configure
entities in the UI without changing the source code
Configurable Entity
Working with OroCRM Entities
Define configuration schema
• Bundle may contain a file with the configuration
schema:
BundleName/Resources/config/entity_config.yml
• The file contains config property definitions of an entity,
field levels, and options used in the UI to display
properties of these configurations.
Configurable Entity
Working with OroCRM Entities
Configuration Provider Service
Each configuration scope generates a service with specific
id. For example, if the scope name is entity, the service id
will be oro_entity_config.provider.entity.
This service may be used to obtain configuration of the
specific scope, class and field.
Implemented by
OroBundleEntityConfigBundleProvider
ConfigProviderInterface
Configurable Entity
Working with OroCRM Entities
Add entity annotations
• Annotation classes
OroBundleEntityConfigBundleMetadataAnnotationConfig
OroBundleEntityConfigBundleMetadataAnnotationConfigField
• Example of @Config and @ConfigField annotations in
an entity.
Configurable Entity
Working with OroCRM Entities
Commands
oro:entity-config:update
This command can be used to update configurable entities.
oro:entity-config:cache:clear
This command removes all data related to configurable entities
from the application cache.
oro:entity-config:debug
Debugging entity configuration.
Configurable Entity
Working with OroCRM Entities
Extended Entity
Working with OroCRM Entities
Features
• Add fields dynamically using configuration
• Add/remove fields dynamically using UI configuration
• Show dynamic fields on view, form and grid
• Support dynamic relations to other entities
Extended Entity
Working with OroCRM Entities
Creating Extended Entity
1. Create extend entity class with special name
2. Make inherit entity class from existing extend entity
3. Create migration
4. Run oro:migration:load command
Example
AcmeBundleHotelBundleEntityHotel extends
AcmeBundleHotelBundleModelExtendHotel
Extended Entity
Working with OroCRM Entities
Adding Fields to Extended Entity
• Using UI
• Using migrations
Extended Entity
Working with OroCRM Entities
oro:entity-extend:cache:clear
This command removes all entity extend functionality data from
the application cache.
oro:entity-extend:update-config
This command prepares configuration for extended entities.
oro:migration:load
This command updates extend entity cache and makes the
necessary schema updates.
Commands
Extended Entity
Working with OroCRM Entities
Summary
• All entities in OroCRM are based on Doctrine Entity.
• Configurable entity can store an entity or a field
metadata
• New fields can be added to an existing entity without
alternating the entity source code
• All changes in the entity structure and entity
configuration should be included into the migration
classes
Extended Entity
Working with OroCRM Entities
Q & A
Pavel Kargapoltsev
pkargapoltsev@magecore.com

Más contenido relacionado

La actualidad más candente

Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play FrameworkKnoldus Inc.
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed introRich Helton
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the TrenchesXavier Noria
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)ukdpe
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.Rich Helton
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6aminmesbahi
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introductionCommit University
 
.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8aminmesbahi
 
.NET Core, ASP.NET Core Course, Session 17
.NET Core, ASP.NET Core Course, Session 17.NET Core, ASP.NET Core Course, Session 17
.NET Core, ASP.NET Core Course, Session 17aminmesbahi
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)Hendrik Ebbers
 

La actualidad más candente (20)

Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Wt unit 3
Wt unit 3 Wt unit 3
Wt unit 3
 
Wt unit 4
Wt unit 4Wt unit 4
Wt unit 4
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
 
Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)Mike Taulty OData (NxtGen User Group UK)
Mike Taulty OData (NxtGen User Group UK)
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.
 
This is how we REST
This is how we RESTThis is how we REST
This is how we REST
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6.NET Core, ASP.NET Core Course, Session 6
.NET Core, ASP.NET Core Course, Session 6
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Java 8 concurrency abstractions
Java 8 concurrency abstractionsJava 8 concurrency abstractions
Java 8 concurrency abstractions
 
.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8.NET Core, ASP.NET Core Course, Session 8
.NET Core, ASP.NET Core Course, Session 8
 
.NET Core, ASP.NET Core Course, Session 17
.NET Core, ASP.NET Core Course, Session 17.NET Core, ASP.NET Core Course, Session 17
.NET Core, ASP.NET Core Course, Session 17
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
Angular 2
Angular 2Angular 2
Angular 2
 

Similar a Working with oro crm entities

ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity apiDrupalCamp Kyiv Рысь
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API ModuleSergiu Savva
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13aminmesbahi
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptxrani marri
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014Matthias Noback
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)rashmita_mishra
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.Luigi Viggiano
 
20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_ormKenan Sevindik
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Salesforce Developers
 
Poco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignPoco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignJames Phillips
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual BasicSangeetha Sg
 

Similar a Working with oro crm entities (20)

ознакомления с модулем Entity api
ознакомления с модулем Entity apiознакомления с модулем Entity api
ознакомления с модулем Entity api
 
Understanding the Entity API Module
Understanding the Entity API ModuleUnderstanding the Entity API Module
Understanding the Entity API Module
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
.Net template solution architecture
.Net template solution architecture.Net template solution architecture
.Net template solution architecture
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13.NET Core, ASP.NET Core Course, Session 13
.NET Core, ASP.NET Core Course, Session 13
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
KAAccessControl
KAAccessControlKAAccessControl
KAAccessControl
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm20160523 hibernate persistence_framework_and_orm
20160523 hibernate persistence_framework_and_orm
 
Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1Mastering the Lightning Framework - Part 1
Mastering the Lightning Framework - Part 1
 
Hibernate
HibernateHibernate
Hibernate
 
Poco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignPoco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class Design
 
Objects and classes in Visual Basic
Objects and classes in Visual BasicObjects and classes in Visual Basic
Objects and classes in Visual Basic
 
Hibernate
HibernateHibernate
Hibernate
 

Más de Oro Inc.

Jary Carter Presents OroCRM
Jary Carter Presents OroCRMJary Carter Presents OroCRM
Jary Carter Presents OroCRMOro Inc.
 
Best Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company OnlineBest Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company OnlineOro Inc.
 
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017Oro Inc.
 
How to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce SystemsHow to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce SystemsOro Inc.
 
Email is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, ParisEmail is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, ParisOro Inc.
 
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, ParisB2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, ParisOro Inc.
 
Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...Oro Inc.
 
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in ParisRevolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in ParisOro Inc.
 
Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?Oro Inc.
 
Oro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketingOro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketingOro Inc.
 
Oro Meetup in London - Oro product vision
Oro Meetup in London - Oro product visionOro Meetup in London - Oro product vision
Oro Meetup in London - Oro product visionOro Inc.
 
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”Oro Inc.
 
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...Oro Inc.
 
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”Oro Inc.
 
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM..."New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...Oro Inc.
 
Benefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento WebinarBenefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento WebinarOro Inc.
 
Benefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM WebinarBenefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM WebinarOro Inc.
 
OroCRM Multi-Channel Webinar
OroCRM Multi-Channel WebinarOroCRM Multi-Channel Webinar
OroCRM Multi-Channel WebinarOro Inc.
 
Powerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + ZendeskPowerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + ZendeskOro Inc.
 
Integration with presta shop webinar
Integration with presta shop webinarIntegration with presta shop webinar
Integration with presta shop webinarOro Inc.
 

Más de Oro Inc. (20)

Jary Carter Presents OroCRM
Jary Carter Presents OroCRMJary Carter Presents OroCRM
Jary Carter Presents OroCRM
 
Best Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company OnlineBest Practices For Taking Your B2B Company Online
Best Practices For Taking Your B2B Company Online
 
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
Oro Revolutionizes B2B Commerce - OroMeetup NL, 2017
 
How to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce SystemsHow to Close More Deals with B2B eCommerce Systems
How to Close More Deals with B2B eCommerce Systems
 
Email is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, ParisEmail is the digital key - dotmailer, Oro MeetUp, Paris
Email is the digital key - dotmailer, Oro MeetUp, Paris
 
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, ParisB2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
B2B, soyez prêts pour la 2ème vague e-commerce - Akeneo, Oro MeetUp, Paris
 
Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...Comment April Moto met en place une relation client multicanal et augmente so...
Comment April Moto met en place une relation client multicanal et augmente so...
 
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in ParisRevolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
Revolutionizing CRM market & B2B eCommerce - Oro MeetUp in Paris
 
Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?Oro Meetup London - Allies: How can we really turn data into profit?
Oro Meetup London - Allies: How can we really turn data into profit?
 
Oro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketingOro London Meetup - dotmailer: Faster, smarter, better, email marketing
Oro London Meetup - dotmailer: Faster, smarter, better, email marketing
 
Oro Meetup in London - Oro product vision
Oro Meetup in London - Oro product visionOro Meetup in London - Oro product vision
Oro Meetup in London - Oro product vision
 
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
Webinar: “Create the Ultimate Customer Experience with Prestashop + OroCRM”
 
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
11.17.15 Webinar: “Merchants: deliver an outstanding experience to your custo...
 
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
11.10.15 Webinar: “Improving Magento performance with Blackfire.io”
 
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM..."New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
"New OroCRM Release Demo: Discover what’s new in the latest release of OroCRM...
 
Benefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento WebinarBenefits of OroCRM + Magento Webinar
Benefits of OroCRM + Magento Webinar
 
Benefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM WebinarBenefits of Magento + OroCRM Webinar
Benefits of Magento + OroCRM Webinar
 
OroCRM Multi-Channel Webinar
OroCRM Multi-Channel WebinarOroCRM Multi-Channel Webinar
OroCRM Multi-Channel Webinar
 
Powerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + ZendeskPowerful Customer Service with OroCRM + Zendesk
Powerful Customer Service with OroCRM + Zendesk
 
Integration with presta shop webinar
Integration with presta shop webinarIntegration with presta shop webinar
Integration with presta shop webinar
 

Working with oro crm entities

  • 1. Working with OroCRM Entities Working with OroCRM Entities
  • 2. Working with OroCRM Entities Agenda • Doctrine entity • Configurable entity • Extended entity
  • 3. Working with OroCRM Entities Doctrine Entity
  • 4. Working with OroCRM Entities Overview Entities are PHP objects that can be identified over many requests by a unique identifier or primary key. These classes don’t need to extend any abstract base class or interface. An entity class must not be final or contain final methods. Additionally it must not implement clone nor wakeup or do so safely. An entity contains persistable properties. A persistable property is an instance variable of the entity that is saved into and retrieved from the database by Doctrine’s data mapping capabilities. Doctrine 2 ORM Documentation http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/getting-started. html Doctrine Entity
  • 5. Working with OroCRM Entities How to add Doctrine entity? ● Create PHP Class to represent DB table, e.g. AcmeBundleHotelBundleEntityHotel ● Use DoctrineORMMapping to add Doctrine annotation to class ● Create Oro Migration DB tables schema, e.g. acme_hotel ● Command oro:migration:load You can find more about Doctrine ORM in the documentation http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html Doctrine Entity
  • 6. Working with OroCRM Entities Oro Migrations ● Bundle defines it’s own tables in the database schema ● Incremental change of database schema is placed in separate migration class ● Each migration class has it own version Doctrine Entity
  • 7. Working with OroCRM Entities Configurable Entity
  • 8. Working with OroCRM Entities Overview and Features • Two levels of configuration: entity and entity field • Support of different configuration scopes • Configuration schema: BundleName/Resources/config/entity_config.yml • Access to configuration field values is provided by services • Users with the appropriate permissions can configure entities in the UI without changing the source code Configurable Entity
  • 9. Working with OroCRM Entities Define configuration schema • Bundle may contain a file with the configuration schema: BundleName/Resources/config/entity_config.yml • The file contains config property definitions of an entity, field levels, and options used in the UI to display properties of these configurations. Configurable Entity
  • 10. Working with OroCRM Entities Configuration Provider Service Each configuration scope generates a service with specific id. For example, if the scope name is entity, the service id will be oro_entity_config.provider.entity. This service may be used to obtain configuration of the specific scope, class and field. Implemented by OroBundleEntityConfigBundleProvider ConfigProviderInterface Configurable Entity
  • 11. Working with OroCRM Entities Add entity annotations • Annotation classes OroBundleEntityConfigBundleMetadataAnnotationConfig OroBundleEntityConfigBundleMetadataAnnotationConfigField • Example of @Config and @ConfigField annotations in an entity. Configurable Entity
  • 12. Working with OroCRM Entities Commands oro:entity-config:update This command can be used to update configurable entities. oro:entity-config:cache:clear This command removes all data related to configurable entities from the application cache. oro:entity-config:debug Debugging entity configuration. Configurable Entity
  • 13. Working with OroCRM Entities Extended Entity
  • 14. Working with OroCRM Entities Features • Add fields dynamically using configuration • Add/remove fields dynamically using UI configuration • Show dynamic fields on view, form and grid • Support dynamic relations to other entities Extended Entity
  • 15. Working with OroCRM Entities Creating Extended Entity 1. Create extend entity class with special name 2. Make inherit entity class from existing extend entity 3. Create migration 4. Run oro:migration:load command Example AcmeBundleHotelBundleEntityHotel extends AcmeBundleHotelBundleModelExtendHotel Extended Entity
  • 16. Working with OroCRM Entities Adding Fields to Extended Entity • Using UI • Using migrations Extended Entity
  • 17. Working with OroCRM Entities oro:entity-extend:cache:clear This command removes all entity extend functionality data from the application cache. oro:entity-extend:update-config This command prepares configuration for extended entities. oro:migration:load This command updates extend entity cache and makes the necessary schema updates. Commands Extended Entity
  • 18. Working with OroCRM Entities Summary • All entities in OroCRM are based on Doctrine Entity. • Configurable entity can store an entity or a field metadata • New fields can be added to an existing entity without alternating the entity source code • All changes in the entity structure and entity configuration should be included into the migration classes Extended Entity
  • 19. Working with OroCRM Entities Q & A Pavel Kargapoltsev pkargapoltsev@magecore.com