Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1743

[GH-315] [WIP] Allowing proxies to be passed to ORM public API

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of Ocramius:

      Url: https://github.com/doctrine/doctrine2/pull/315

      Message:

      Basically, following happens:

      ```php
      $proxy = some_unserialization();
      $em->persist($proxy); // exception because the class name is not recognized
      ```

      Fortunately, just some replacements of `get_class($entity)` with `Doctrine\Common\Util\ClassUtils::getClass($entity)` fix the issue.

      I wanted to leave this as [WIP] because I need some feedback on the test cases. All three tests fail without the patch, while [![Build Status](https://secure.travis-ci.org/Ocramius/doctrine2.png?branch=getclass-on-proxies-refactoring)](http://travis-ci.org/Ocramius/doctrine2) with it applied.

      What is a bit tricky is the status of the proxies.

      Cases where `$_initialized_ = false;` && `$_identifier = array();` and others fail because of notices and weird issues that are very difficult to hunt down. That is because of the strange nature of proxies obviously. I just wanted to know if this should be somehow fixed in here.

      Another issue is probably performance, as there is some minor overhead introduced. What I'd like to know is if https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Util/ClassUtils.php#L56 could be reduced to a `if ($object instanceof Proxy)

      { ... }

      `.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-315] was synchronize
        https://github.com/doctrine/doctrine2/pull/315

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-315] was synchronize https://github.com/doctrine/doctrine2/pull/315
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-315] was closed:
        https://github.com/doctrine/common/pull/315

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-315] was closed: https://github.com/doctrine/common/pull/315

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: