问题
I checked the documentation, but can't seem to find what I'm looking for. I have two tables:
Pages Layouts
With a table between (pages__layouts) that does the many-to-many. This is working great. However, when referencing the relationship, I always want:
$p->layout[1]
To be the most recent layout that also has a status of 1. Is there a conditional many-to-many in the model or do I do this in the Controller when I reference the layout for the first time?
I have just been using lazy loading to get the layouts when I need them.
Thanks
回答1:
You can specify conditions on the relation definition. At the moment these are only honoured when you use eager loading, lazy loading ignores then.
There is an open ticket to get this fixed.
来源:https://stackoverflow.com/questions/10788210/fuelphp-ordering-many-to-many-relations