Closed jraede closed 11 years ago
From the looks of it, the current classname doesn't get stored at all, so it will recurse back into Store anyway. Some serious refactoring is needed here.
Can you check if this fixes it, and if not, re-open this issue? I'm not in a position to test much atm...
Yep, looks like that fixed it.
Cool, thanks for the feedback.
This is RE: the fix I suggested here: http://fuelphp.com/forums/discussion/12540/to_array-bug-with-nested-singular-relations
The issue now is that adding the model class to the array references should happen BEFORE running $rel->to_array(). As it is now, with a relationship model of:
STORE has many PRODUCTS PRODUCT belongs to STORE
It will loop through the store's related products, then get down to line 1916, add the product's store, then get down to line 1898, add all products again, then for each product get down to line 1916, etc. Essentially lines 1917 and 1916 should switch places so that the store model only gets added once.