-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: doctrine identity problem when using $this
in a method of proxified objects
#710
Comments
Hello, please, could you share your factories? |
https://github.com/KDederichs/sf-reproducer/tree/foundy/proxy_save here's a reproducer for that, just default factories as they come out of the box |
thank you for the reproducer, I'll soon check this! |
hye @KDederichs sorry for the late reply. this problem gaves us headaches 🤯 for now, this cannot be fixed in an other way than using |
Haha yeah it's a strange one for sure, I'll keep using |
$this
in a method of proxified objects
Hey,
I just updated to 2.2 from 1.38 and I found an issue where foundry doesn't correctly handle objects that are created by proxy objects.
Given that you have a class
Foo
:When you create a new
Foo
usingFooFactory::createOne()
and then callcreateABarAndAddToFoo()
and_save()
on the createdFoo
object this will result in an error like this:This error obviously should happen since the
Foo
object has been created by the factory earlier and thus exists/is persisted.This was not an issue in the
1.x
version of Foundry.You can 'fix' it by prefixing the
createABarAndAddToFoo
call with a_real()
but I'd rather have it work correctly :)The text was updated successfully, but these errors were encountered: