Is it possible to use references for many to many relationships? #338
Answered
by
roxblnfk
Shelamkoff
asked this question in
Q&A
-
Hi, an exception is thrown when trying to save a relationship using a reference object. foreach (json_decode($data['tags'], true) as $tag) {
$post->tags->add(isset($tag['id']) ?
new Reference('tag', ['id' => $tag['id']])
: new Tag($tag['name'])
);
}
$entityManager->persist($post, true)->run(); |
Beta Was this translation helpful? Give feedback.
Answered by
roxblnfk
Apr 27, 2022
Replies: 1 comment 2 replies
-
I'm not sure that should work in the current implementation. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Shelamkoff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure that should work in the current implementation.
It looks like good feature request: supporting for case when subitem of HasMany/ManyToMany relation can be Reference