####Recommendations for migration to Doctrine 2.5
#####Start from doctrine/dbal version 2.5.0
-
Please take into account on DB schema migrations that create indices.
Doctrine\DBAL\Schema\Tablethrows exception for already existing indexes, but before it skips them. -
Please check that Column declaration of a primary key does not contain
uniqueattribute, otherwisedoctrine:schema:updatemay generate an additional unique index for the primary key.
//In this declaration doctrine:schema:update generates unique index
/**
* @var string
*
* @ORM\Id
* @ORM\Column(type="string", length=255, unique=true)
*/
protected $name;
//In this declaration doctrine:schema:update does not generate unique index
/**
* @var string
*
* @ORM\Id
* @ORM\Column(type="string", length=255)
*/
protected $name;- Added support of json type for PostgreSQL >=9.2. So if you used this data type before (it stored json data in database like text), we recommended to create migration and convert your old data from text to json, e.g see Oro\Bundle\ReportBundle\Migrations\Schema\v1_4\UpdateReportJsonArrayQuery .
Do not foget construction
USING <column>::JSON, it checks that your text data is valid json.
To be able to compare json data we recommended to use function CAST to convert json data to the text:
$queryBuilder->andWhere('cast(<table>.<column> as text) = :data')
...
$queryBuilder->expr()->like('cast(<table>.<column> as text)', ':data')#####Start from doctrine/dbal version 2.5.1
The automatic renaming of autogenerated indices was disabled because it may be a very heavy operation for existing database and require a lot of effort from developers to change existing migrations as well.
#####Start from doctrine/orm version 2.5.0
- When using
Doctrine\ORM\QueryBuilderit needs to specify the table name and column in the conditions. We recommended to check conditions in your queries. For more detailed information see http://www.doctrine-project.org/jira/browse/DDC-2780.
$queryBuilder
...
//This case DOES NOT work!
->where('users IS NULL')
...
//This case works properly
->where('users.id IS NULL')Doctrine\ORM\Mapping\DefaultQuoteStrategy::getColumnAlias- small changes in the columns aliases. In case you have unit test that checks native sql queries you will probably have to correct them.
-- Before
SELECT c0_.id AS id0 FROM table1 c0_
-- After
SELECT c0_.id AS id_0 FROM table1 c0_#####Start from doctrine/doctrine-bundle version 1.4.0
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::shutdown- clears own services. For the functional tests we recommend to callparent::tearDown()whentearDownmethod is overridden.
#####More details you can find in Doctrine documentation:
- http://docs.doctrine-project.org/en/latest/changelog/migration_2_5.html
- https://github.com/doctrine/doctrine2/blob/2.5/UPGRADE.md
- https://github.com/doctrine/dbal/blob/v2.5.1/UPGRADE.md
- https://github.com/doctrine/DoctrineBundle/blob/v1.4.0/Changelog.md
####PropertyAccess Component
- Removed
Oro\Component\PropertyAccess\PropertyPathandOro\Component\PropertyAccess\PropertyPathInterface,Symfony\Component\PropertyAccess\PropertyPathandSymfony\Component\PropertyAccess\PropertyPathInterfaceshould be used instead - Removed
Oro\Component\PropertyAccess\Exceptionnamespace,Symfony\Component\PropertyAccess\Exceptionis used
####CommentBundle
- Removed
applicableattribute fromcommentscope of entity configs. Now comments can be enabled for most entities, except dictionaries and some internal entities, like Attachment, File, etc.
####EmailBundle
- The format of object returned by GET /api/rest/{version}/emails and GET /api/rest/{version}/emails resources was changed. Not a email body is returned as "body" and "bodyType" properties rather than "emailBody" object. Possible values for "bodyType" are "text" and "html". Possible values for the "importance" property are "low", "normal" and "high" rather than -1, 0 and 1. The "recipients" property was removed and three new properties were added instead: "to", "cc" and "bcc". The format of "folders" collection was changed as well, now each folder can have the following properties: "origin", "fullName", "name" and "type". Possible values for "type" property are "inbox", "sent", "trash", "drafts", "spam" and "other".
####EntityBundle
- Entity aliases are introduced. You can use
php app/console oro:entity-alias:debugCLI command to see all aliases. In most cases aliases are generated automatically, but you can useentity_aliasesandentity_alias_exclusionssection in theResources/config/oro/entity.ymlof your bundle to define your rules. - Methods
encodeClassNameanddecodeClassNameofOro\Bundle\EntityBundle\Tools\EntityRoutingHelperare deprecated. UsegetUrlSafeClassNameandresolveEntityClassinstead. AlsoOro\Bundle\EntityBundle\Tools\EntityClassNameHelpercan be used for same purposes. - The entity name resolver service was introduced to allow configuring an entity name formatting more flexible. Now
Oro\Bundle\EntityBundle\Provider\EntityNameResolveris used instead ofOro\Bundle\LocaleBundle\Formatter\NameFormatterandOro\Bundle\LocaleBundle\DQL\DQLNameFormatter. The list of affected services: - Added new method
\Oro\Bundle\EntityBundle\ORM\DoctrineHelper::isNewEntityto check entity is new.
| Service ID | Class Name |
|---|---|
| oro_activity_list.manager | Oro\Bundle\ActivityListBundle\Entity\Manager\ActivityListManager |
| oro_calendar.calendar_event_manager | Oro\Bundle\CalendarBundle\Manager\CalendarEventManager |
| oro_calendar.calendar_provider.user | Oro\Bundle\CalendarBundle\Provider\UserCalendarProvider |
| oro_calendar.autocomplete.user_calendar_handler | Oro\Bundle\CalendarBundle\Autocomplete\UserCalendarHandler |
| oro_comment.comment.api_manager | Oro\Bundle\CommentBundle\Entity\Manager\CommentApiManager |
| oro_email.email.model.builder.helper | Oro\Bundle\EmailBundle\Builder\Helper\EmailModelBuilderHelper |
| oro_email.emailtemplate.variable_provider.user | Oro\Bundle\EmailBundle\Provider\LoggedUserVariablesProvider |
| oro_email.datagrid_query_factory | Oro\Bundle\EmailBundle\Datagrid\EmailQueryFactory |
| oro_email.workflow.action.send_email | Oro\Bundle\EmailBundle\Workflow\Action\SendEmail |
| oro_email.workflow.action.send_email_template | Oro\Bundle\EmailBundle\Workflow\Action\SendEmailTemplate |
| oro_email.activity_list.provider | Oro\Bundle\EmailBundle\Provider\EmailActivityListProvider |
| oro_entity_merge.listener.render.localized_value_render | Oro\Bundle\EntityMergeBundle\EventListener\Render\LocalizedValueRenderListener |
| oro_form.autocomplete.full_name.search_handler | Oro\Bundle\FormBundle\Autocomplete\FullNameSearchHandler |
| oro_note.manager | Oro\Bundle\NoteBundle\Entity\Manager\NoteManager |
| oro_reminder.model.email_notification | Oro\Bundle\ReminderBundle\Model\Email\EmailNotification |
| oro_user.autocomplete.user.search_acl_handler.abstract | Oro\Bundle\UserBundle\Autocomplete\UserAclHandler |
| oro_workflow.action.format_name | Oro\Bundle\WorkflowBundle\Model\Action\FormatName |
| orocrm_account.form.type.account | OroCRM\Bundle\AccountBundle\Form\Type\AccountType |
| orocrm_account.form.type.account.api | OroCRM\Bundle\AccountBundle\Form\Type\AccountApiType |
| orocrm_case.view_factory | Oro\Bundle\CaseBundle\Model\ViewFactory |
- Added Query Hint Resolver
- Removed
Oro\Bundle\EntityBundle\ORM\EntityConfigAwareRepositoryInterfaceinterface - Removed
Oro\Bundle\EntityBundle\ORM\Query\FilterCollectionclass andoro_entity.orm.sql_filterDIC tag - The
Oro\Bundle\EntityBundle\ORM\OroEntityManagertriggerspreCloseevent occurs when the EntityManager#close() operation is invoked, before EntityManager#clear() is invoked.
####EntityConfigBundle
- The DI container tag
oro_service_methodand the classOro\Bundle\EntityConfigBundle\DependencyInjection\Utils\ServiceMethodare deprecated and will be removed soon. - IMPORTANT: if you use the service method links in your
entity_config.ymlthey should be replaced with the direct service method call. For examplemy_service_method_linkshould be replaced with@my_service->method. - Removed the method
initConfigof the classOro\Bundle\EntityConfigBundle\Provider\PropertyConfigContainer. Oro\Bundle\ConfigBundle\Config\UserScopeManageris no longer depends onsecurity.context. It is retrieved fromservice.containerdirectly inside- Removed
$regenerateCachesargument fromOro\Bundle\EntityConfigBundle\Config\ConfigManager::getIdsmethod
####ActivityListBundle
- Removed
$regenerateCachesargument fromOro\Bundle\ActivityListBundle\Provider\ActivityListChainProvider::getTargetEntityClassesmethod
####ImportExportBundle
Oro\Bundle\ImportExportBundle\Context\ContextInterfaceadded $incrementBy integer parameter for methods: incrementReadCount, incrementAddCount, incrementUpdateCount, incrementReplaceCount, incrementDeleteCount, incrementErrorEntriesCount
####WorkflowBundle Migrate conditions logic to ConfigExpression component:
- Removed
Oro\Bundle\WorkflowBundle\Model\Condition\ConditionInterface,Oro\Component\ConfigExpression\ExpressionInterfaceshould be used instead - Removed
Oro\Bundle\WorkflowBundle\Model\Condition\ConditionFactory,Oro\Component\ConfigExpression\ExpressionFactoryshould be used instead - Removed
Oro\Bundle\WorkflowBundle\Model\Condition\ConditionAssembler,Oro\Component\ConfigExpression\ExpressionAssemblershould be used instead - Removed all conditions in
Oro\Bundle\WorkflowBundle\Model\Conditionnamespace, corresponding conditions from ConfigExpression component (Oro\Component\ConfigExpression\Conditionnamespace) should be used instead
####FormBundle
Oro\Bundle\FormBundle\Form\Extension\RandomIdExtensionby default adds unique suffix to id attribute of each form typeOro\Bundle\FormBundle\Model\UpdateHandlertriggers events that can be used to modify data and interrupt processing, also this handler has new constructor argument used to inject EventDispatcherOro\Bundle\FormBundle\Form\Type\OroJquerySelect2HiddenTyperemoved support forextra_configandextra_modulesoptions, usecomponentoption instead (the value reflects what js-module will be used as Select2Component)Oro\Bundle\FormBundle\Form\Type\EnumFilterTypesecond constructor argument was changed from instance ofDoctrine\Common\Persistence\ManagerRegistrytoOro\Bundle\EntityExtendBundle\Provider\EnumValueProvider
####SyncBundle
Removed parameters websocket_host and websocket_port from parameters.yml. Instead the following websocket configuration is used:
websocket_bind_address: 0.0.0.0
websocket_bind_port: 8080
websocket_frontend_host: "*"
websocket_frontend_port: 8080
websocket_backend_host: "*"
websocket_backend_port: 8080websocket_bind_portandwebsocket_bind_addressspecify port and address to which the Clank server binds on startup and waits for incoming requests. By default (0.0.0.0), it listens to all addresses on the machinewebsocket_backend_portandwebsocket_backend_hostspecify port and address to which the application should connect (PHP). By default ("*"), it connects to 127.0.0.1 address.websocket_frontend_portandwebsocket_frontend_hostspecify port and address to which the browser should connect (JS). By default ("*"), it connects to host specified in the browser.- Renamed
oro_wamp.db_pingservice. New name isoro_wamp.ping.pdo.
####SoapBundle
- Removed
EntitySerializerManagerInterface. The serialization methods inApiEntityManagerclass should be used instead.
####UiBundle
- Macros
scrollDatainOro/Bundle/UIBundle/Resources/views/macros.html.twigtriggers eventoro_ui.scroll_data.before.<pageIdentifier>before data rendering - Added
assets_versionparameter for outdating assets if needed - Added parameters
EventDispatcherInterface $eventDispatcherand$pageTypeto constructor ofOro\Bundle\UIBundle\Provider\GroupingChainWidgetProvider - Created new event
Oro\Bundle\UIBundle\Event\BeforeGroupingChainWidgetEventwhich is dispatched inOro\Bundle\UIBundle\Provider\GroupingChainWidgetProvider
####LocaleBundle
- Deprecated method {{localeSettings.getTimeZoneShift()}} (calendar-view.js, formatter/datetime.js, datepicker/datetimepicker-view-mixin.js)
- Deprecated method {{dateTimeFormatter.applyTimeZoneCorrection()}} (calendar-view.js, jquery-ui-datepicker-l10n.js)
- Deprecated method {{calendarView.options.timezone}} and {{calendarView.applyTzCorrection()}}
- Deprecated method {{datetimepickerViewMixin.timezoneShift}}
####UserBundle
Oro\Bundle\UserBundle\Security\AdvancedApiUserInterfaceis no longer extendsSymfony\Component\Security\Core\User\UserInterface.Oro\Bundle\UserBundle\Entity\Useris based onOro\Bundle\UserBundle\Entity\AbstractUserand implementsSymfony\Component\Security\Core\User\UserInterfaceusingOro\Bundle\UserBundle\Entity\UserInterfacedirectlyOro\Bundle\UserBundle\Entity\PasswordRecoveryInterfaceintroduced to cover all required data for password recoveryOro\Bundle\UserBundle\Entity\UserInterfacemethodpublic function addRole(RoleInterface $role)signature changed to useSymfony\Component\Security\Core\Role\RoleInterfaceOro\Bundle\UserBundle\Mailer\Processoris now based onOro\Bundle\UserBundle\Mailer\BaseProcessorOro\Bundle\UserBundle\Mailer\Processor- first argument$userofsendChangePasswordEmail,sendResetPasswordEmailandsendResetPasswordAsAdminEmailmethods must implementOro\Bundle\UserBundle\Entity\UserInterface- First argument
Doctrine\Common\Persistence\ObjectManager $objectManagerand fourth argumentOro\Bundle\UserBundle\Entity\UserManager $userManagerofOro\Bundle\UserBundle\Mailer\Processorconstructor (which now is located inOro\Bundle\UserBundle\Mailer\BaseProcessor) replaced byDoctrine\Common\Persistence\ManagerRegistry $managerRegistryandOro\Bundle\EmailBundle\Tools\EmailHolderHelper $emailHolderHelperaccordingly Oro\Bundle\UserBundle\Form\Handler\AclRoleHandleris now accepts Manager Registry instead of Entity Manager, added methodsetManagerRegistry, methodsetEntityManagermarked as deprecated- Changed a login form to be correspond Symfony standards. If you have overridden
login.html.twig, please change{{ error|trans }}to{{ error.messageKey|trans(error.messageData, 'security') }}there. - Removed
Oro\Bundle\UserBundle\Entity\Sessionentity.
####SecurityBundle
Oro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataInterfacewas introduced and based on access levels, considered to use in security layer instead of directOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadatausageOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataisOrganizationOwneddeprecated, useisGlobalLevelOwnedinsteadisBusinessUnitOwneddeprecated, useisLocalLevelOwnedinsteadisUserOwneddeprecated, useisBasicLevelOwnedinsteadgetOrganizationColumnNamedeprecated, usegetGlobalOwnerColumnNameinsteadgetOrganizationFieldNamedeprecated, usegetGlobalOwnerFieldNameinstead
Oro\Bundle\SecurityBundle\ORM\Walker\OwnershipConditionDataBuildermethod signature changed to useOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataInterfaceinstead ofOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataprotected function buildConstraintIfAccessIsGranted($targetEntityClassName, $accessLevel, OwnershipMetadataInterface $metadata)protected function getOrganizationId(OwnershipMetadataInterface $metadata = null)protected function getCondition($idOrIds, OwnershipMetadataInterface $metadata, $columnName = null, $ignoreOwner = false)protected function getColumnName(OwnershipMetadataInterface $metadata, $columnName = null)
Oro\Bundle\SecurityBundle\Owner\Metadata\MetadataProviderInterfacewas introduced and based on access levels, considered to use in security layer instead of directOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataProviderusageOro\Bundle\SecurityBundle\Owner\Metadata\ChainMetadataProvider- chain for ownership metadata providers which implements newOro\Bundle\SecurityBundle\Owner\Metadata\MetadataProviderInterfaceOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataProvider- is based on
Oro\Bundle\SecurityBundle\Owner\Metadata\AbstractMetadataProviderand implementsOro\Bundle\SecurityBundle\Owner\Metadata\MetadataProviderInterface - added public method
setSecurityFacade(SecurityFacade $securityFacade) getOrganizationClassdeprecated, usegetGlobalLevelClassinsteadgetBusinessUnitClassdeprecated, usegetLocalLevelClassinsteadgetUserClassdeprecated, usegetBasicLevelClassinstead
- is based on
Oro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataProvideradded intoOro\Bundle\SecurityBundle\Owner\Metadata\ChainMetadataProviderchain using tagoro_security.owner.metadata_providerOro\Bundle\SecurityBundle\Acl\Extension\EntityAclExtension- fourth constructor argument
$metadataProvidernow must implementOro\Bundle\SecurityBundle\Owner\Metadata\MetadataProviderInterface fixMaxAccessLeveldeprecated, useMetadataProviderInterface::getMaxAccessLevelinstead
- fourth constructor argument
- Class methods and constructors deprecated, please inject
@service_containerand appropriate methods insteadOro\Bundle\SecurityBundle\EventListener\ConsoleContextListenerdefined usingoro_security.listener.console_context_listenerserviceOro\Bundle\SecurityBundle\Owner\EntityOwnershipDecisionMakerdefined usingoro_security.owner.decision_makerserviceOro\Bundle\SecurityBundle\Owner\Metadata\OwnershipMetadataProviderdefined usingoro_security.owner.ownership_metadata_providerservice
- ACL parameter
group_nameis now used to separate permissions in application scopes - Constructor was changed from implementation
public function __construct(OwnershipMetadataProvider $provider)to interfacepublic function __construct(MetadataProviderInterface $provider)Oro\Bundle\SecurityBundle\Cache\OwnershipMetadataCacheClearerOro\Bundle\SecurityBundle\Cache\OwnershipMetadataCacheWarmerOro\Bundle\SecurityBundle\EventListener\OwnershipConfigSubscriberOro\Bundle\SecurityBundle\Owner\EntityOwnerAccessorOro\Bundle\SecurityBundle\ORM\Walker\OwnershipConditionDataBuilder
- Services rely on
oro_security.owner.metadata_provider.chaininstead of implementationoro_security.owner.ownership_metadata_provideroro_security.owner.ownership_metadata_provider.cache.warmeroro_security.owner.ownership_metadata_provider.cache.cleareroro_security.owner.ownership_config_subscriberoro_security.owner.entity_owner_accessororo_security.orm.ownership_sql_walker_builder
- Constructor was changed from implementation
public function __construct(OwnerTreeProvider $treeProvider)to interfacepublic function __construct(OwnerTreeProviderInterface $treeProvider)Oro\Bundle\SecurityBundle\Cache\OwnerTreeCacheWarmerOro\Bundle\SecurityBundle\Cache\OwnerTreeCacheCleanerOro\Bundle\SecurityBundle\ORM\Walker\OwnershipConditionDataBuilder
- Services rely on
oro_security.ownership_tree_provider.chaininstead of implementationoro_security.ownership_tree_provideroro_security.ownership_tree.cache.cleaneroro_security.ownership_tree.cache.warmeroro_security.orm.ownership_sql_walker_builder
- Service
@oro_security.link.ownership_tree_provideris deprecated, please useSymfony\Component\DependencyInjection\ContainerInterfacedirectly
####AddressBundle
Oro\Bundle\AddressBundle\Form\EventListener\FixAddressesPrimaryAndTypesSubscribermarked deprecated. UseOro\Bundle\AddressBundle\Form\EventListener\FixAddressesPrimarySubscriberandOro\Bundle\AddressBundle\Form\EventListener\FixAddressesTypesSubscriberinstead.
####DataGridBundle
Oro\Bundle\DataGridBundle\Datasource\ResultRecordnow has methodaddDatathat allows to add additional information to record
####DataAuditBundle
Oro\Bundle\DataAuditBundle\Loggable\LoggableManagerlogEntityClassandlogEntityFieldClassparameters replaced byoro_dataaudit.loggable.audit_entity_mapperservicegetAuditEntryClassandgetAuditEntryFieldClassmethods- Removed
$entityClassparameter fromisEntityAuditablemethod ofOro\Bundle\DataAuditBundle\Placeholder\AuditableFilter.
####SearchBundle
- Added brackets for search queries. Now user available to do queries like 'from oro_test where all_text ~ test and (integer count > 10 or float price = 10)'
andWhere,orWhere,where,getOptions,setMaxResults,getMaxResults,setFirstResult,getFirstResult,setOrderBy,getOrderBy,getOrderType,getOrderDirectionmethods are deprecated forOro\Bundle\SearchBundle\Query\Queryclass. UsegetCriteriaandgetCriteriamethods what will return and set Criteria of query.- Every Search request now is ACL protected. So, search results will contain only records what current user can see.
####ActivirtBundle
- Added entity config parameter
show_on_pagetoOro/Bundle/ActivityBundle/Resources/config/entity_config.yml
####ActivityListBundle
- Added parameter
ConfigProvider $configProviderto constructor of\Oro\Bundle\ActivityListBundle\Placeholder\PlaceholderFilter - Added parameter
$pageTypetoisApplicablemethod in\Oro\Bundle\ActivityListBundle\Placeholder\PlaceholderFilter - Added method
isAllowedButtonto\Oro\Bundle\ActivityListBundle\Placeholder\PlaceholderFilter
####AttachmentBundle
- Added parameter
DoctrineHelper $doctrineHelperto constructor of\Oro\Bundle\AttachmentBundle\Placeholder\PlaceholderFilter
####NoteBundle
- Added parameter
DoctrineHelper $doctrineHelperto constructor of\Oro\Bundle\NoteBundle\Placeholder\PlaceholderFilter