So, 1:M / M:1 relations don\'t work the way M:M relations work (obviously), but I thought that with proper configuration, you can get the same output as a M:M relation.
Looks like you're doing it right. Don't worry about the PersistentCollection
/ArrayCollection
stuff -- all that matters is that they're collections.
$Path->getOffers()
should indeed return a collection of PathOffers
, and each PathOffer
should have an offer.
So it ought to work like this:
//Output a all offers associated with a path, along with the position.
$pathOffers = $path->getOffers();
foreach($pathOffers as $po){
echo $po->getOffer()->id . ' [' . $po->getPosition() . "]\n";
}
Am I missing something?