ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 7 replies, has 4 voices, and was last updated by Dima Soroka Dima Soroka 8 months, 3 weeks ago.

  • Creator
    Topic
  • #8279

    scivray
    Participant

    Hello,
    I’m using two orm connection, the default one and another one called pim.

    From a controller, the following code works fine :

    But in the datagrid.yml, I got the following error :

    with the following configuration :

    Is there a way to specify the entity_manager name in datagrid.yml ?
    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #8335
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello, scivray.

    Yes, this is an issue, we’ll need to fix it.

    As a temporary solution you can create your own datasource similar to default one, inject there custom entity manager and use your new datasource.

    #8336

    scivray
    Participant

    Hello,
    Ok, thank you.

    #9154

    Tamas.Palecian
    Participant

    Hello,
    Could you please tell me how you done a different database connection?
    I mean how I would use 2 databases in the same orocrm application

    I tried to use the:
    http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html
    And I got some errors with the namespaces.

    Thank you,
    Tamas

    #9155

    scivray
    Participant

    Hi,
    In config.yml, I got the following in order to use the default connection and my custom pim connection:

    doctrine:
    dbal:
    default_connection: default
    connections:
    default:
    driver: “%database_driver%”
    host: “%database_host%”
    port: “%database_port%”
    dbname: “%database_name%”
    user: “%database_user%”
    password: “%database_password%”
    charset: UTF8
    pim:
    driver: “%database_driver_pim%”
    host: “%database_host_pim%”
    port: “%database_port_pim%”
    dbname: “%database_name_pim%”
    user: “%database_user_pim%”
    password: “%database_password_pim%”
    charset: UTF8

    orm:
    default_entity_manager: default
    entity_managers:
    default:
    connection: default
    class_metadata_factory_name: Oro\Bundle\EntityExtendBundle\Mapping\ExtendClassMetadataFactory

    mappings:
    OroActivityBundle: ~
    OroActivityListBundle: ~
    OroAddressBundle: ~
    OroAsseticBundle: ~
    OroAttachmentBundle: ~
    OroBatchBundle: ~
    OroBusinessEntitiesBundle: ~
    OroCacheBundle: ~
    OroCalendarBundle: ~
    OroChartBundle: ~
    OroCommentBundle: ~
    OroConfigBundle: ~
    OroCronBundle: ~
    OroDashboardBundle: ~
    OroDataAuditBundle: ~
    OroDataGridBundle: ~
    OroDistributionBundle:
    mapping: false
    is_bundle: true
    OroEmailBundle: ~
    OroEmbeddedFormBundle: ~
    OroEntityBundle: ~
    OroEntityConfigBundle: ~
    OroEntityExtendBundle: ~
    OroEntityMergeBundle: ~
    OroEntityPaginationBundle: ~
    OroFilterBundle: ~
    OroFormBundle: ~
    OroHelpBundle: ~
    OroImapBundle: ~
    OroImportExportBundle: ~
    OroInstallerBundle: ~
    OroIntegrationBundle: ~
    OroLocaleBundle: ~
    OroMigrationBundle: ~
    OroNavigationBundle: ~
    OroNoteBundle: ~
    OroNotificationBundle: ~
    OroOrganizationBundle: ~
    OroPlatformBundle: ~
    OroQueryDesignerBundle: ~
    OroReminderBundle: ~
    OroReportBundle: ~
    OroRequireJSBundle: ~
    OroSearchBundle: ~
    OroSecurityBundle: ~
    OroSegmentBundle: ~
    OroSidebarBundle: ~
    OroSoapBundle: ~
    OroSyncBundle: ~
    OroTagBundle: ~

    OroThemeBundle: ~
    OroTrackingBundle: ~
    OroTranslationBundle: ~
    OroUIBundle: ~
    OroUserBundle: ~
    OroWindowsBundle: ~
    OroWorkflowBundle: ~
    JMSJobQueueBundle: ~
    CLPocBundle: ~
    CLUIBundle: ~

    metadata_cache_driver:
    type: service
    id: doctrine.metadata.cache
    pim:
    connection: pim
    mappings:
    CLPimBundle: ~

    resolve_target_entities:
    Symfony\Component\Security\Core\User\UserInterface: Oro\Bundle\UserBundle\Entity\User

    For argument in service, you have to prefixe entity_manager with the connection name like this :

    cl_pim.datasource.variant:
    class: %cl_pim.datasource.variant.class%
    arguments:
    – @doctrine.orm.pim_entity_manager
    – @oro_datagrid.event.dispatcher
    – @oro_datagrid.datasource.orm.parameter_binder
    tags:
    – {name: oro_datagrid.datasource, type: cl.datasource.variant}

    HTH

    #9160

    Tamas.Palecian
    Participant

    Great, thank you for support,

    Best regards,
    Tamas

    #23205

    scivray
    Participant

    Hi,
    Is this issue fixed now ?

    Regards.

    #24964
    Dima Soroka
    Dima Soroka
    Oro Core

    It is not fixed yet, feel free to submit contribution to https://github.com/orocrm/platform

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.