And you want to know which B is related to both A and A => C?
In these cases, always try to think of how you would write the SQL to produce the required result. And if you have it, convert it to code.
For the ORM, both "B"'s are different collections, so if you need to know which B is related to both, you need to fetch both collections, and do an array_intersect().
ErrorException [ Fatal Error ]: Object of class Model_Measurement could not be converted to string
i found no errors to produce this issue. but it happens.
<?php $measure = array_intersect($student->measurements,$product->measurements); if(count($measure) != 0){ \Debug::dump($measure); } ?> http://bin.fuelphp.com/snippet/view/L6 this is my view.
in the loop you see, one result has same array with same object id. where as another result has different object id, so in second one i need null result in array_intersect. but i getting fatal error.
If you know how array_intersect works, you'll notice it will intersect on the array's values. That means in your case, that each Model_Measurement will be cast to a string. However, it cannot be converted because there is no method __toString() on any Orm\Model. Thus, array_intersect will fail.
You'll need to look into other array_intersect functions. Head over to php.net and find out, what over functions there are of which one will be the one you need (has something to do with the array's keys not its values).