Welcome Guest, Not a member yet? Register   Sign In
unable to delete relationship with datamapper using delete()
#5

[eluser]WanWizard[/eluser]
@johnmerlino,

The issue here is that Datamapper fails to automagically guess the relationship, because it's a self relationship. You have the same model on both sides of the relation, so it picks the first one it can find. Which in your case is the wrong one, and that's why your relations are the wrong way around.

You will have to specify on which relationship you want to operate:
Code:
// save an explicit relation
$parent = new Category(1);
$child = new Category(2);

// related them
$parent->save_related_category($child);

// and delete it
$parent->delete_related_category($child);


Messages In This Thread
unable to delete relationship with datamapper using delete() - by El Forum - 04-15-2011, 02:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB