-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
[Bug] @EmbedOne @EmbedMany without targetDocument on 2.0@beta-1 #1961
Comments
I believe we could treat the only entry Offhand, @Dragonqos what's the use case for an embedded document with one entry? Is it being prepared for the future extension? |
One entry in discriminatorMap is just for example for test. My application has at least 5 embedded document. |
@Dragonqos thanks for providing a test case. You are correct, an association without a target document is perfectly valid, so we should fix the wrong typehint. |
Hope it will be fixed asap) |
Any updates on this? |
@Dragonqos I've just submitted #1983 with a fix |
Allow returning null from getAssociationTargetClass
#1983 was merged, closing here. Thanks for bringing this up @Dragonqos! |
Bug Report
Trying to create EmbedOne/EmbedMany Relation with discriminatorMap and discriminatorType only, getting error on Metadata parse:
Summary
When we calling
$class = $metadata->getAssociationTargetClass($property);
from file api-platform/core/src/Bridge/Doctrine/MongoDbOdm/PropertyInfo/DoctrineExtractor.php:69 and targetDocument is not defined method should return NULL instead of STRING, but that action was restricted by type hint in file MongoDB/Mapping/ClassMetadata.php:1743Current behavior
public function getAssociationTargetClass($assocName) : string
returns STRING or throw FatalError
How to reproduce
Expected behavior
public function getAssociationTargetClass($assocName) : ?string
returns STRING or NULL
The text was updated successfully, but these errors were encountered: