Skip to content

Loading…

DDC-2480: Filter stops working after upgrade to Symfony 2.3rc1 #3199

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user mgruner:

In our project we have two associated entities "portal" and "objectdata". To get all objectdata 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!

@doctrinebot

Comment created by @ocramius:

[~mgruner] the issue is incomplete - can you provide a failing example or even better a test case?

@doctrinebot

Comment created by mgruner:

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.

@doctrinebot

Issue was closed with resolution "Invalid"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.