With Propel ORM (1.6.5), when I joinWith() a table "A" to table "B" and then later call toArray() on the result PropelObjectCollection, the entry for B in each A record contains all the records for A again (see dump below).
A is LEFT JOINd to B. Each record in A points to exactly one in B. Code I am using:
$oAQuery = AQuery::create()
->joinB('b', Criteria::LEFT_JOIN)
->useBQuery()
->_if(strlen($sB))
->filterByBField1(str_replace(' ', '%', $sCity))
->_endif()
->endUse()
->with('b');
$oCollection = $oAQuery->find();
$aArray = $oAQuery->toArray();
toArray() dump:
Array
(
[0] => Array
(
[Field1] => 29
[Field2] => 0
[B] => Array
(
[BField1] => 7
[BField2] => 10
[As] => Array
(
[A_0] => *RECURSION*
[A_1] => Array
(
[Field1] = 234
[Field2] = 3424
...
I want to stop this, primarily, because there are many records and with the recursion I easily go over a 512m memory_limit for PHP (i even did 2048m for a test, still went over)