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

Referencing literal self variables #1107

Open
xDaizu opened this issue Feb 9, 2022 · 1 comment
Open

Referencing literal self variables #1107

xDaizu opened this issue Feb 9, 2022 · 1 comment
Labels

Comments

@xDaizu
Copy link

xDaizu commented Feb 9, 2022

This code works:

  teacher_community_2:
    __factory:
      from:
        id: ~
        forename: 'Joshua'
        surname: '<lastName()>'
        displayName: 'Dr. $surname'

But this one doesn't:

  teacher_community_2:
    __factory:
      from:
        id: ~
        forename: 'Joshua'
        surname: 'Potato'
        displayName: 'Dr. $surname'

It throws:

In UnresolvableValueExceptionFactory.php line 77:
                                         
  Could not find a variable "$surname".  

Apparently, the own variables are only available if they come from a Faker source; but not if they are defined as a literal.

@self->surname does not work either, since it throws:

In ObjectNotFoundExceptionFactory.php line 23:
                                                                                            
  Could not find the object "teacher_community_2" of the class "Teacher".  

Is this a bug or am I missing something in the documentation?

@theofidry
Copy link
Member

theofidry commented Feb 12, 2022

No that definitely looks like a bug.

the own variables are only available if they come from a Faker source

That should not be the case

@self->surname

And this should work

@theofidry theofidry added the Bug label Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants