-
-
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
On doctrine:fixtures:load if data-fixtures cannot get a reference will f... #90
Conversation
…l fail with a undefined index. I think this can be improve, to really pass the message undefined reference. So I improved from this: [ErrorException] Notice: Undefined index: database_1_1 in /home/www/eb/platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/ReferenceRepository.php line 145 To: [Exception] Undefined reference database_1_1
Please add a unit test to avoid regression |
@@ -142,6 +142,9 @@ public function addReference($name, $object) | |||
*/ | |||
public function getReference($name) | |||
{ | |||
if (empty($this->references[$name])) { | |||
throw new \Exception('Undefined reference ' . $name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use InvalidaArgumentException
instead of Exception
IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof +1
Changed to InvalidArgumentException and improved to instead use empty use the method hasReference (makes much more sense) and I updated PHPdoc (forget before). About the regression test sounds good, but I just run the README and I think I made what is suppose to run the tests but without success, I would be glad to add a test if you can give me some help.
|
Fixed by #179 |
On doctrine:fixtures:load if data-fixtures cannot get a reference will fail with a undefined index.
I think this can be improve, to really pass the message undefined reference.
So I improved from this:
[ErrorException]
Notice: Undefined index: database_1_1 in /home/www/eb/platform/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/ReferenceRepository.php line 145
To:
[Exception]
Undefined reference database_1_1