Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

ORM, Active Records, Many-to-Many Relationships: Reverse Action of "associate"

posted by rogge 8 years ago

Hey guys

I'm using Flourish with great joy and satisfaction. Thanks for your work!

Similarly to the "Related Records Operations" section of the fActiveRecord I have a table with users and a table with user groups. They are in a many-to-many relationship. As pointed out in the doc I associate them using

$user->associateUserGroup( array( 'groupname' ) );

I'm currently building a little panel where users can be administered. As group membership should not be non-reversible I'm in need for an "unassociate" operation to destroy the relationship between a user and a user group.

My current solution is to delete the corresponding row in the relationship table ("users_groups" in the fActiveRecord doc). But that's rather non-ORM style.

Is there a "plain ORM" way? Thanks!