The way many to many behaves, does not appear to be very intuitive, and is not nice to use. for example
$tag1 = \Tag::findFirst('id=1');
$tag2 = \Tag::findFirst('id=2');
$tag3 = \Tag::findFirst('id=3');
// create a post
$post = new \Post();
$post->tags = array($tag1, $tag2);
$post->save();
// edit a post
$post = \Post::findFirst('id=1'); // the same post that was created earlier
$post->tags = array($tag1, $tag3);
$post->save();
Will tend to mean the post ends up with all three tags, possibly even with an extra copy of tag1, rather than just 2 as might be expected, and how Doctrine works.
Is this a bug, or intended behaviour?
Some official word on this would be great, seems to attract a few people asking about it http://forum.phalconphp.com/discussion/2190/many-to-many-expected-behaviour
thanks :)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The way many to many behaves, does not appear to be very intuitive, and is not nice to use. for example
Will tend to mean the post ends up with all three tags, possibly even with an extra copy of tag1, rather than just 2 as might be expected, and how Doctrine works.
Is this a bug, or intended behaviour?
Some official word on this would be great, seems to attract a few people asking about it http://forum.phalconphp.com/discussion/2190/many-to-many-expected-behaviour
thanks :)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.