alice
alice copied to clipboard
Cannot use <current()> to get another object
I have a list of generated objects of an entity. Each object has different properties and can use different factories, but it doesn't matter. The second entity uses the result of the first one. It works correctly. But applying the same way for the third entity doesn't work.
# source
EntityOne:
one_{case_1}:
__construct:
val: 1
name: <current()>
one_{case_2}:
__construct:
val: 2
name: <current()>
one_diff_{case_3}:
__construct:
val: 3
name: <current()>
one_diff_{case_4}:
__construct:
val: 4
name: <current()>
# it works
EntityTwo:
two_{@one_diff_*}:
__construct:
parent: <current()>
# it doesn't work and throws an exception like Could not find the fixture "two_New one".
EntityThree:
three_{@one_diff_*}:
__construct:
parent: <current()>
another_parent: '@two_<current()>'
I've found a workaround to fix it through using EntityTwo and its parent. But I expected that the previous one helped me.
EntityThree:
three_{@two_*}:
__construct:
parent: <($current->getParent())>
another_parent: '<current()>'
Does it work if you remove {
and }
from the lines of EntityOne
? Maybe the parser is confused by the one_{case_1}
syntax.