Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2196

EntityManager can't be extended easily

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3.1
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
      None

      Description

      public static function create($conn, Configuration $config, EventManager $eventManager = null)
      {
          // ...
          return new EntityManager($conn, $config, $conn->getEventManager());
      }
      

      The EntityManager::create method uses new on the EntityManager class instead of static.

      This makes extending that class not practical because we have to rewrite (duplicate) EntityManager::create.

      Code could be extendable with:

      public static function create($conn, Configuration $config, EventManager $eventManager = null)
      {
          // ...
          return new static($conn, $config, $conn->getEventManager());
      }
      

        Activity

        Matthieu Napoli created issue -
        Hide
        Matthieu Napoli added a comment -
        Show
        Matthieu Napoli added a comment - Pull request is here: https://github.com/doctrine/doctrine2/pull/535
        Hide
        Benjamin Eberlei added a comment -

        Its not desired to override the EntityManager, we are currently building a PR to build a decorator for the EntityManager instead. You can decorate the EntityManager yourself.

        Show
        Benjamin Eberlei added a comment - Its not desired to override the EntityManager, we are currently building a PR to build a decorator for the EntityManager instead. You can decorate the EntityManager yourself.
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        Matthieu Napoli added a comment -

        Benjamin Eberlei Shouldn't it be final then?

        Show
        Matthieu Napoli added a comment - Benjamin Eberlei Shouldn't it be final then?

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2196, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Matthieu Napoli
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: