Doctrine Common
  1. Doctrine Common
  2. DCOM-189

Doctrine Proxies may conflict with interfaced constructors

    Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The Doctrine ProxyGenerator generates for a proxy a constructor. The documentation of Doctrine states that the constructor is never called. For a project, I created a group of entities with a interfaced constructor in order to enforce a common interface. This results in a incompatible proxy and so a fatal error.

        Activity

        Harmen M created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Resolution Can't Fix [ 7 ]
        Marco Pivetta made changes -
        Resolution Can't Fix [ 7 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Hide
        Marco Pivetta added a comment -

        Cannot fix this - the constructor is required to override instantiation logic

        Show
        Marco Pivetta added a comment - Cannot fix this - the constructor is required to override instantiation logic
        Marco Pivetta made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Can't Fix [ 7 ]
        Marco Pivetta made changes -
        Comment [ Cannot fix this - the constructor is required to override instantiation logic ]
        Harmen M made changes -
        Summary Doctrine Proxies have a constructor Doctrine Proxies may conflict with interfaced constructors
        Description The Doctrine ProxyGenerator generates for a proxy a constructor. The documentation of Doctrine states that the constructor is never called. For a project, I created a group of entities with a interfaced constructor in order to enforce a common interface. This results in a incompatible proxy and so a fatal error.
        Hide
        Harmen M added a comment -

        Edit: added the correct description. I accidentially submitted the form before editing the description.

        Show
        Harmen M added a comment - Edit: added the correct description. I accidentially submitted the form before editing the description.
        Hide
        Marco Pivetta added a comment -

        Harmen M why do you have a constructor in an interface? That's a very bad practice, and it makes things quite hard to handle.

        I can think of a workaround, but I first want to be sure there's a real advantage in changing the current implementation to use

        unserialize()

        just to handle this specific use case.

        Show
        Marco Pivetta added a comment - Harmen M why do you have a constructor in an interface? That's a very bad practice, and it makes things quite hard to handle. I can think of a workaround, but I first want to be sure there's a real advantage in changing the current implementation to use unserialize() just to handle this specific use case.
        Hide
        Benjamin Eberlei added a comment -

        Adding __construct to an interface is an anti pattern and shouldn't be done.

        Show
        Benjamin Eberlei added a comment - Adding __construct to an interface is an anti pattern and shouldn't be done.
        Hide
        Harmen M added a comment -

        Ok, then I change my implementation.

        But, maybe it is an idea to update the documentation of the ORM and state that constructor interfacing is not possible?
        http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/architecture.html

        Show
        Harmen M added a comment - Ok, then I change my implementation. But, maybe it is an idea to update the documentation of the ORM and state that constructor interfacing is not possible? http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/architecture.html
        Marco Pivetta made changes -
        Resolution Can't Fix [ 7 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Marco Pivetta made changes -
        Issue Type Bug [ 1 ] Documentation [ 6 ]
        Hide
        Marco Pivetta added a comment -

        I actually had more requests for this feature on a similar project ( https://github.com/Ocramius/ProxyManager/issues/115 ).
        I will mark this as feature request, but can't guarantee that it will get into Doctrine 2.x, since it may be a BC break.

        Show
        Marco Pivetta added a comment - I actually had more requests for this feature on a similar project ( https://github.com/Ocramius/ProxyManager/issues/115 ). I will mark this as feature request, but can't guarantee that it will get into Doctrine 2.x, since it may be a BC break.
        Marco Pivetta made changes -
        Issue Type Documentation [ 6 ] Improvement [ 4 ]
        Marco Pivetta made changes -
        Priority Major [ 3 ] Minor [ 4 ]

        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=DCOM-189, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Harmen M
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: