OroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM
from
a developer's perspective
Yevhen Shyshkin
yshyshkin@orocrm.com
https://github.com/yshyshkin
OroPlatform and OroCRM from a developer's perspective
Backend structure
OroPlatform and OroCRM from a developer's perspective
Backend MVC
Controller
- controller class
- routing
- events
Model
- Doctrine entities
- services
- events
View
- twig templates
- placeholders
OroPlatform and OroCRM from a developer's perspective
Frontend structure
OroPlatform and OroCRM from a developer's perspective
Frontend MVC
OroPlatform and OroCRM from a developer's perspective
Symfony basics
- composer as package manager
- code packed into bundles
- each bundle might provide:
- entities
- routing
- configuration
- services
- tests
OroPlatform and OroCRM from a developer's perspective
Dependency Injection
parameters:
oro_datagrid.datagrid.manager.class:
OroBundleDataGridBundleDatagridManager
services:
oro_datagrid.datagrid.manager:
class: %oro_datagrid.datagrid.manager.class%
arguments:
- @oro_datagrid.configuration.provider.chain
- @oro_datagrid.datagrid.builder
- @oro_datagrid.datagrid.request_parameters_factory
- @oro_datagrid.datagrid.name_strategy
OroPlatform and OroCRM from a developer's perspective
DI Events
parameters:
oro_datagrid.event_listener.ormdatasource_acl.class:
OroBundleDataGridBundleEventListenerOrmDatasourceAclListener
services:
oro_datagrid.event_listener.ormdatasource_acl:
class: %oro_datagrid.event_listener.ormdatasource_acl.class%
arguments:
- @oro_security.acl_helper
tags:
- { name: kernel.event_listener, event:
oro_datagrid.orm_datasource.result.before, method: onResultBefore }
OroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM from a developer's perspective
Doctrine
- ORM
- operates with entities
- has its own language DQL
- uses UnitOfWork to perform operations
- UnitOfWork has events
OroPlatform and OroCRM from a developer's perspective
Doctrine manipulations
OroPlatform and OroCRM from a developer's perspective
Doctrine entities
- data representation layer
- not domain models
- have relations between entities
- have lifecycle callback events
OroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM from a developer's perspective
Configurable entities
- entity and fields have additional metadata
- can be modified in UI
- bundles add their own configuration
OroPlatform and OroCRM from a developer's perspective
Configuration example
* @Config(
* routeName="orocrm_contact_index",
* routeView="orocrm_contact_view",
* defaultValues={
* "entity"={
* "icon"="icon-group",
* },
* "form"={
* "form_type"="orocrm_contact_select",
* "grid_name"="contacts-select-grid",
* },
* "grid"={
* "default"="contacts-grid",
* }
* }
* )
OroPlatform and OroCRM from a developer's perspective
Extended entities
$staticField1
$staticField2
$staticField3
. . .
$extendedField1
$extendedField2
$extendedField3
Entity
Static
Doctrine fields
Extended (dynamic)
OroPlatform fields
OroPlatform and OroCRM from a developer's perspective
Extension example
$this->extendExtension->addEnumField(
$schema,
'orocrm_sales_lead',
'source',
'lead_source'
);
$this->extendExtension->addManyToOneRelation(
$schema,
$table,
'campaign',
'orocrm_campaign',
'combined_name',
['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]]
);
OroPlatform and OroCRM from a developer's perspective
Datagrids
- declarative style
- use DQL to build query
- can be extended
- have events
OroPlatform and OroCRM from a developer's perspective
Datagrid example
roles-grid:
source:
type: orm
query:
select:
- r.id
- r.label
from:
- { table: OroUserBundle:Role, alias: r }
columns:
label:
label: oro.user.role.label.label
sorters:
columns:
label:
data_name: r.label
filters:
columns:
label:
type: string
data_name: r.label
OroPlatform and OroCRM from a developer's perspective
Workflows
BA
- entity manipulations
- state machine: steps + transitions
- UI management
- conditions
- actions
OroPlatform and OroCRM from a developer's perspective
Workflow definition
workflows:
task_flow:
label: 'Task Flow'
entity: OroCRMBundleTaskBundleEntityTask
entity_attribute: task
start_step: open
OroPlatform and OroCRM from a developer's perspective
Workflow steps
workflows:
task_flow:
steps:
open:
label: 'Open'
order: 10
allowed_transitions:
- start_progress
- close
in_progress:
label: 'In progress'
order: 20
allowed_transitions:
- stop_progress
- close
...
OroPlatform and OroCRM from a developer's perspective
Workflow transitions
workflows:
task_flow:
transitions:
start_progress:
label: 'Start progress'
step_to: in_progress
frontend_options:
icon: 'icon-play'
transition_definition: start_progress_definition
stop_progress:
label: 'Stop progress'
step_to: open
frontend_options:
icon: 'icon-stop'
transition_definition: stop_progress_definition
...
OroPlatform and OroCRM from a developer's perspective
OroPlatform and OroCRM from a developer's perspective
What else?
- search
- security
- import/export
- reports and segments
- migrations
- documentation - general and bundle
- code style
- tests - unit, functional, selenium
OroPlatform and OroCRM from a developer's perspective
Developers environment
- PHP Storm
- Symfony plugin
- xdebug
- phpcs / phpmd / phpcpd
OroPlatform and OroCRM from a developer's perspective
Q & A

OroPlatform and OroCRM from a developer's perspective

  • 1.
    OroPlatform and OroCRMfrom a developer's perspective OroPlatform and OroCRM from a developer's perspective Yevhen Shyshkin yshyshkin@orocrm.com https://github.com/yshyshkin
  • 2.
    OroPlatform and OroCRMfrom a developer's perspective Backend structure
  • 3.
    OroPlatform and OroCRMfrom a developer's perspective Backend MVC Controller - controller class - routing - events Model - Doctrine entities - services - events View - twig templates - placeholders
  • 4.
    OroPlatform and OroCRMfrom a developer's perspective Frontend structure
  • 5.
    OroPlatform and OroCRMfrom a developer's perspective Frontend MVC
  • 6.
    OroPlatform and OroCRMfrom a developer's perspective Symfony basics - composer as package manager - code packed into bundles - each bundle might provide: - entities - routing - configuration - services - tests
  • 7.
    OroPlatform and OroCRMfrom a developer's perspective Dependency Injection parameters: oro_datagrid.datagrid.manager.class: OroBundleDataGridBundleDatagridManager services: oro_datagrid.datagrid.manager: class: %oro_datagrid.datagrid.manager.class% arguments: - @oro_datagrid.configuration.provider.chain - @oro_datagrid.datagrid.builder - @oro_datagrid.datagrid.request_parameters_factory - @oro_datagrid.datagrid.name_strategy
  • 8.
    OroPlatform and OroCRMfrom a developer's perspective DI Events parameters: oro_datagrid.event_listener.ormdatasource_acl.class: OroBundleDataGridBundleEventListenerOrmDatasourceAclListener services: oro_datagrid.event_listener.ormdatasource_acl: class: %oro_datagrid.event_listener.ormdatasource_acl.class% arguments: - @oro_security.acl_helper tags: - { name: kernel.event_listener, event: oro_datagrid.orm_datasource.result.before, method: onResultBefore }
  • 9.
    OroPlatform and OroCRMfrom a developer's perspective
  • 10.
    OroPlatform and OroCRMfrom a developer's perspective Doctrine - ORM - operates with entities - has its own language DQL - uses UnitOfWork to perform operations - UnitOfWork has events
  • 11.
    OroPlatform and OroCRMfrom a developer's perspective Doctrine manipulations
  • 12.
    OroPlatform and OroCRMfrom a developer's perspective Doctrine entities - data representation layer - not domain models - have relations between entities - have lifecycle callback events
  • 13.
    OroPlatform and OroCRMfrom a developer's perspective
  • 14.
    OroPlatform and OroCRMfrom a developer's perspective Configurable entities - entity and fields have additional metadata - can be modified in UI - bundles add their own configuration
  • 15.
    OroPlatform and OroCRMfrom a developer's perspective Configuration example * @Config( * routeName="orocrm_contact_index", * routeView="orocrm_contact_view", * defaultValues={ * "entity"={ * "icon"="icon-group", * }, * "form"={ * "form_type"="orocrm_contact_select", * "grid_name"="contacts-select-grid", * }, * "grid"={ * "default"="contacts-grid", * } * } * )
  • 16.
    OroPlatform and OroCRMfrom a developer's perspective Extended entities $staticField1 $staticField2 $staticField3 . . . $extendedField1 $extendedField2 $extendedField3 Entity Static Doctrine fields Extended (dynamic) OroPlatform fields
  • 17.
    OroPlatform and OroCRMfrom a developer's perspective Extension example $this->extendExtension->addEnumField( $schema, 'orocrm_sales_lead', 'source', 'lead_source' ); $this->extendExtension->addManyToOneRelation( $schema, $table, 'campaign', 'orocrm_campaign', 'combined_name', ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM]] );
  • 18.
    OroPlatform and OroCRMfrom a developer's perspective Datagrids - declarative style - use DQL to build query - can be extended - have events
  • 19.
    OroPlatform and OroCRMfrom a developer's perspective Datagrid example roles-grid: source: type: orm query: select: - r.id - r.label from: - { table: OroUserBundle:Role, alias: r } columns: label: label: oro.user.role.label.label sorters: columns: label: data_name: r.label filters: columns: label: type: string data_name: r.label
  • 20.
    OroPlatform and OroCRMfrom a developer's perspective Workflows BA - entity manipulations - state machine: steps + transitions - UI management - conditions - actions
  • 21.
    OroPlatform and OroCRMfrom a developer's perspective Workflow definition workflows: task_flow: label: 'Task Flow' entity: OroCRMBundleTaskBundleEntityTask entity_attribute: task start_step: open
  • 22.
    OroPlatform and OroCRMfrom a developer's perspective Workflow steps workflows: task_flow: steps: open: label: 'Open' order: 10 allowed_transitions: - start_progress - close in_progress: label: 'In progress' order: 20 allowed_transitions: - stop_progress - close ...
  • 23.
    OroPlatform and OroCRMfrom a developer's perspective Workflow transitions workflows: task_flow: transitions: start_progress: label: 'Start progress' step_to: in_progress frontend_options: icon: 'icon-play' transition_definition: start_progress_definition stop_progress: label: 'Stop progress' step_to: open frontend_options: icon: 'icon-stop' transition_definition: stop_progress_definition ...
  • 24.
    OroPlatform and OroCRMfrom a developer's perspective
  • 25.
    OroPlatform and OroCRMfrom a developer's perspective What else? - search - security - import/export - reports and segments - migrations - documentation - general and bundle - code style - tests - unit, functional, selenium
  • 26.
    OroPlatform and OroCRMfrom a developer's perspective Developers environment - PHP Storm - Symfony plugin - xdebug - phpcs / phpmd / phpcpd
  • 27.
    OroPlatform and OroCRMfrom a developer's perspective Q & A