OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions DatagridBundle entity not in default entity_manager

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

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #33709

    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
  • #33710

    Yevhen Shyshkin
    Participant

    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.

    #33711

    scivray
    Participant

    Hello,
    Ok, thank you.

    #33712

    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

    #33713

    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

    #33714

    Tamas.Palecian
    Participant

    Great, thank you for support,

    Best regards,
    Tamas

    #33715

    scivray
    Participant

    Hi,
    Is this issue fixed now ?

    Regards.

    #33716

    Dima Soroka
    Keymaster

    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)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top