-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DoctrineBridge] [PropertyInfo] Catch Doctrine\ORM\Mapping\MappingException #17152
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
Conversation
Doctrine is missing to document the possible exception: https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php#L47 As it does not specify which exception can be thrown, it would make more sense the catch all exceptions ( |
Catching all exceptions to ignore them could start a debugging nightmare... |
The ORM MappingException case here can happen when using older versions of the ORM (in newer versions, the ORM exceptions extends from the Common one and so is catched already). @Tobion an invalid mapping always throws a MappingException. Other exceptions could be thrown because of bugs, but these one should be kept uncaught here. |
@stof I don't see that ORM MappingException extends the common one: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/MappingException.php#L27 |
oh, I thought it did. This looks weird. |
👍 |
1 similar comment
👍 |
Thank you @dunglas. |
…\MappingException (dunglas) This PR was squashed before being merged into the 2.8 branch (closes #17152). Discussion ---------- [DoctrineBridge] [PropertyInfo] Catch Doctrine\ORM\Mapping\MappingException | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Sometimes the Doctrine ORM `ClassMetadataFactory` throws a `Doctrine\Common\Persistence\Mapping\MappingException` exception, sometime a `Doctrine\ORM\Mapping\MappingException`. This PR catch both. Port of dunglas/php-property-info#10. Commits ------- ceded10 [DoctrineBridge] [PropertyInfo] Catch Doctrine\ORM\Mapping\MappingException
Sometimes the Doctrine ORM
ClassMetadataFactory
throws aDoctrine\Common\Persistence\Mapping\MappingException
exception, sometime aDoctrine\ORM\Mapping\MappingException
.This PR catch both.
Port of dunglas/php-property-info#10.