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

Force update on hasMany relation

Hey All

I have a case, where I have a model Robots with a hasMany relation to RobotParts. In the case of an update of Robots which include a RobotParts, where the RobotParts does not include an id, then RobotParts is created, and the whole validation for RobotParts is beforeCreate, etc.

My questions is, can i force update on all related models, so the validation will fail if eg. RobotParts->is is not set?

Thanks in advance

BR \Mads



950

Can you show me the code? kkkk I didn't undestand