Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-22279

Integrate storage engine configuration with DoctrineBundle connections

    XMLWordPrintable

Details

    • Ventoux Sprint 5

    Description

      Follow up of EZP-22151.

      Repository configuration regarding DBAL connection should integrate correctly with DoctrineBundle.

      Benefits

      • More standard approach, Symfony wise.
      • Allow developers to seamlessly use Doctrine ORM
      • Simplifies configuration in ezpublish.yml

      Solution

      DoctrineBundle uses the concept of connections which are re-usable. Idea is to make it possible to use a defined connection:

      # Using Doctrine default connection
      doctrine:
          dbal:
              driver:   pdo_mysql
              host:     localhost
              port:     3306
              dbname:   ezdemo
              user:     root
              password: root
              charset:  UTF8
       
      ezpublish:
          repositories:
              # Takes all default values (engine: legacy, connection: default)
              main: ~
       
          system:
              ezdemo_group:
                  # Optional, if not provided, will take the first defined repository by default
                  repository: main
       
      #####
       
      # Using a named Doctrine connection
      doctrine:
          dbal:
              default_connection:       default
              connections:
                  default:
                      dbname:           Symfony2
                      user:             root
                      password:         null
                      host:             localhost
                  my_connection:
                      dbname:           customer
                      user:             root
                      password:         null
                      host:             localhost
       
      ezpublish:
          repositories:
              main:
                  # legacy => Legacy storage engine
                  engine: legacy
                  connection: my_connection
      

      Also, if no connection is configured, it would use the default one.

      For a developer to reuse this connection in his code for his ORM needs, it would be as simple as:

      namespace Acme\AcmeTestBundle\Controller;
      
      use eZ\Bundle\EzPublishCoreBundle\Controller;
      
      class SomeController extends Controller
      {
          public function indexAction()
          {
              $em = $this->getDoctrine()->getManager( 'my_doctrine_connection' );
          }
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jerome.vieilledent-obsolete@ez.no Jérôme Vieilledent (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2 days, 4 hours Original Estimate - 2 days, 4 hours
                2d 4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 6 hours
                2d 6h