We have 2 models:
So when saving the related OrderItems I need to check some attributes from the parent Order.
Order has attributes: "time_begin" and "time_end" and OrderItem has its own "time_begin" and "time_end". So the rule is that times of the OrderItem must be between times of the parent Order.
For example, I have the following situation:
Any solution??? How to let OrderItem to know that Order has changed?
It's a complicated issue, you may consider this way: - Don't call Order::validate() and OrderItems::validate() simultaneously. - Order::validate() -> Order::save() first than OrderItems::validate() -> OrderItems::save() (is this failed, remember to revert Order if needed)