fuel/orm — pull request #359 by Latouss (2014-08-30 12:38:34+00:00)
Title: Fix on to_array with multi level relations

**First, I fixed a problem in to_array method when having *has_many* relation with a target class having a *has_one* 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 *has_many* 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.