-
-
Notifications
You must be signed in to change notification settings - Fork 226
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
Notice: Undefined index #294
Comments
This requires an isolated test case to be defined first. Scenarios that lead to this kind of problem are when the UnitOfWork contains managed entities with un-managed associations somewhere, which is a dirty state. |
@Ocramius could you give me some links to read about this? |
Can you share your fixtures files to allow reproducing this ? |
what we have found so far that the fixture file was not changed between the point when it worked and now when it does not.
@stof there you go https://pastebin.com/Kig08rek |
UPDATE User entity has a The Notice starts appearing when we remove |
Just as a note: I ran into this issue as well and it disappeared after I started using the EntityManager from the Event Args in favor of the one being constructor-injected by the container. |
Always use the object manager from the event args, never inject one through the constructor. The event args will always contain the entity manager that triggered the event, while one being injected by the container (most likely) will be the default entity manager which might not always be correct. |
@alcaeus, but in a symfony context, one uses dependency-injected services regularly, which very often themselves got EntitiyManagerInterface injected. So one would have to pass the event's EM into all used service methods, and constructor-based dependency injection would not be feasible anmore? BTW: I define only one standard connection and entity manager. Does it then make a difference at all which EM I use? Other scenario: Performance: Is it safe to check, e.g. with |
When running the command
doctrine:fixtures:load
we get e PHP notice in the data fixtures lineThe notice is as follows:
The value of index is different every time we run the command. We use one file for the datafixtures, nothing fancy.
If we add
--no-debug
option, the data is loaded correctly.Has someone also seen this bug? What are the possible reasons of this?
Our composer file:
The text was updated successfully, but these errors were encountered: