Closed franmomu closed 3 years ago
The problem is that in ODM you can have a reference without targetDocument
and even without discriminatorMap
- the ODM will happily store references to anything you feed it with. I have no idea what to do with this yet tho :)
@franmomu the related issue was merged, do you need a release for doctrine/persistence to move this issue forward?
there is no need for a release @malarzm, thank you for taking care of the issue!
Bug Report
Summary
Currently,
ClassMetadata::getAssociationTargetClass
has?string
as return type:https://github.com/doctrine/mongodb-odm/blob/ccf26d9e023387e9aae86951186c043b3222fe70/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php#L1794-L1804
but the interface
ClassMetadata
fromdoctrine/persistence
usesstring
as return type (in the docblock).I guess in
doctrine/persistence
3.0
, the interface will have return types and this would fail.A deprecation could be triggered if the value is
null
, the only place I've seen this method is used, is in:https://github.com/doctrine/mongodb-odm/blob/ccf26d9e023387e9aae86951186c043b3222fe70/lib/Doctrine/ODM/MongoDB/Query/Expr.php#L1415-L1421
I guess that
$classMetadata->hasAssociation($key)
could also be true for a field withdiscriminatorMap
defined, so maybe we could add another check (I don't know which one).