I am using PHP with Flourish. I read their documentation here and here. Let's suppose I have a table persons
and another table items
. Let's suppose further that I have an item_id1
and an item_id2
in the persons
table. Both of them are foreign keys to the items
table. I would like to get a record from the items
table based on the relation between persons
and items
based on the item_id2
foreign key.
If I am not mistaken this could be achieved with
$person->createItem()
if $person
is the fActiveRecord
generated from a record of the persons
table in most of the cases. But in this particular case, when multiple foreign keys point to the very same table. This is understandable, because Flourish
is not able to determine which relation should be used if we do not give it at least a route.
So, if we want to get the record from the items table which corresponds to the item_id2
foreign key, then we should give the route as parameter. I didn't see a description or an example in their documentation which addresses this particular problem, so my question is:
How should we tell createItem
that I want to use the item_id2
key?
$person->createItem("item_id2")
does not work.