Skip to content

[NFR] Many to Many behaviour #17071

@firstactivemedia

Description

@firstactivemedia

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.

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasenew feature requestPlanned Feature or New Feature Request
No fields configured for Feature.

Projects

Status
Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions