Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use <current()> to get another object #1132

Open
dmitrach opened this issue Mar 7, 2023 · 1 comment
Open

Cannot use <current()> to get another object #1132

dmitrach opened this issue Mar 7, 2023 · 1 comment

Comments

@dmitrach
Copy link

dmitrach commented Mar 7, 2023

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()>'
@alexislefebvre
Copy link
Contributor

Does it work if you remove { and } from the lines of EntityOne? Maybe the parser is confused by the one_{case_1} syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants