We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Remove relations from ManyToMany object?

How can I remove existing manytomany relational links from an object?

$robot->parts = $robot->getParts();

I would like to remove relations between some of the parts, how can I achieve this?

Kr, Scripton



33.8k

And why you just not set every $robot->part to null? I think it'll work. But I'm not sure what you really want.



12.1k

That does not work, i have tried modifying the retrieved parts but this results in only the parts that are present being updated. The removed parts do not get removed from the relations upon saving.