Subject: | can't configure to fetch through a belongs_to relationship |
Assume the following relationships:
A == belongs_to ==> B == has_many ==> C
(and relationship names = lc class name)
This does not work as I expected.
I a fixtures config file:
"sets":[
{
"class":"A",
"quantity":"5",
"fetch":[
{
"rel":"b",
"quantity":"all",
"fetch":[
{
"rel":"c",
"quantity":"all"
}
]
}
]
}
]
The C rows are not fetched. I think this is because belongs_to
associations are fetched automatically anyway and the additional config
on the "b" relationship ("fetch" in this case) seems to be ignored.
The only way I could get this to work was by a rule on Result class B
like this:
"sets":[
{
"class":"A",
"quantity":"5"
}
],
"rules":{
"B":{
"fetch":[
{
"rel":"c",
"quantity":"all"
}
]
}
}
Ideally, the first version (recursive definition of relationships to
fetch) should work but if not, then it would be great if the special
behaviour of belongs_to associations could be explained a bit more in
the docs and the work-around via a rule explained.
Thanks for your help!