-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Undefined array key when calling refresh() after updating to 2.20.1 #11785
Comments
Here's a stack trace from our Symfony application:
|
Hello. I add a test that reproduces this issue in 2.20.1 and passes in 2.20.0. The commit is in this branch in my forked repo: Can you please have a look? |
cc @goetas |
Thanks for the super well prepared reproducer. This is an interesting edgecase present in past versions of doctrine. What is the expected behavior of this code? **
* @ORM\Entity
*/
class Report {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @ORM\Column
*/
public $name;
public function __construct($name) {
$this->name = $name;
}
}
$user = new Report('foo');
$em->persist($foo);
$em->refresh($foo); Currently most doctrine versions will trigger the error I see at least two options.
option 2 seems the most backward compatible approach, 3 seems the best (a little more complex but not that much) |
Maybe 2 + a deprecation, and then 1 in doctrine 4? |
Bug Report
Summary
After updating to 2.20.1, in some circumstances, calling
refresh()
on an Entity returns anUndefined array key
errorCurrent behavior
When calling
refresh()
on an entity, anUndefined array key
exception is thrown.Expected behavior
The entity should be refreshed from the db and no error shown.
How to reproduce
I haven't been able to produce a minimal reproducible example, probably because our Entity setup is very complex.
However, reverting the changes in blem solves the issue for us.
The text was updated successfully, but these errors were encountered: