Closed ltoussaint closed 10 years ago
First, I fixed a problem in to_array method when having _hasmany relation with a target class having a _hasone relation.
When having relations like
School -has_many-> School_Class_1 -has_one-> School_Class_1_Info School_Class_2 -has_one-> School_Class_2_Info School_Class_3 -has_one-> School_Class_3_Info
The to_array method only inject the first instance of School_Class_Info. So I get array like
school => array( ... school_class_1 => array( ... school_class_1_info => array(...) ), school_class_2 => array(...), // Without school_class_2_info school_class_3 => array(...), // Without school_class_3_info )
In a second commit, I add circular reference check on _hasmany relation
Logically this case should not happen with a good data model, but if we want to check circular references, we need to do it in all cases.
@stevewest looks ok?
Yea, looks ok to me.
First, I fixed a problem in to_array method when having _hasmany relation with a target class having a _hasone relation.
When having relations like
The to_array method only inject the first instance of School_Class_Info. So I get array like
In a second commit, I add circular reference check on _hasmany relation
Logically this case should not happen with a good data model, but if we want to check circular references, we need to do it in all cases.