Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2480

Filter stops working after upgrade to Symfony 2.3rc1

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      Mac OS, Symfony 2.3rc1

      Description

      In our project we have two associated entities "portal" and "object_data". To get all object_data of an object that belong to a portal, we use filtering code like this since symfony 2.0:

              $object_data = $object->getObjectData()->filter(
                  function ($current_object_data) use ($portal) {
                      return $current_object_data->getPortal() === $portal;
                  }
              )->first();
      

      Up to now, this worked just fine. When upgrading from Symfony 2.2 to 2.3rc1, this code stopped working, the comparison will always be false. I also received a PHP error message in another place about the portal entity not being convertible to a string:

      PHP Catchable fatal error:  Object of class ...\\Entity\\Portal 
      could not be converted to string in /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php on line 1211
      

      I assume these problems are related. Since the code worked just fine from Symfony 2.0 to 2.2, I assume that this might be a regression. Could you kindly take a look at this and perhaps let me know if I did anything wrong?

      We use direct entity comparisons in many places in our code, rather than comparing the ids of the entities directly, and so far it worked just fine.

      Thanks a lot!

        Activity

        Hide
        Marco Pivetta added a comment -

        Martin Gruner the issue is incomplete - can you provide a failing example or even better a test case?

        Show
        Marco Pivetta added a comment - Martin Gruner the issue is incomplete - can you provide a failing example or even better a test case?
        Hide
        Martin Gruner added a comment -

        Sorry for the delay. This issue was caused by a bug about aliased services in symfony 2.3.0 and is fixed in 2.3.1. We likely had more than one instance of the entity manager present leading to the wrong behaviour.

        Show
        Martin Gruner added a comment - Sorry for the delay. This issue was caused by a bug about aliased services in symfony 2.3.0 and is fixed in 2.3.1. We likely had more than one instance of the entity manager present leading to the wrong behaviour.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: