-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
How to user multiple times relation? #648
Comments
Or how to chec condition? If @user->isActive() assign him to this fixture |
I think you can do it by using variable references: AppBundle\Entity\Venue:
venue_{0..9}:
name (unique): '<text(30)>'
address: '<address()>'
description: '<sentence()>'
maxSpace: '<numberBetween(400, 600)>'
AppBundle\Entity\Event:
event_{0..499}:
venue: '@venue*'
# ...
totalTickets: '<numberBetween(150, $venue->maxSpace)>' This should work, but I may not have accounted for that in the Expression Language... But if it doesn't, it something that should be added |
venue: '@venue*'
...
totalTickets: '<numberBetween(150, $venue->maxSpace)>' Gives error venue: '@venue*'
...
totalTickets: '<numberBetween(150, $venue*->maxSpace)>' Gives error So still nothing :( |
Should be I'm not sure I want to give support for this thing with the current Expression Language, maybe this would be more easily doable with #601. Meanwhile, an easy although less elegant way is to use a faker provider: class EventProvider
{
public function maxSpace(Venue $venue)
{
return $venue->getMaxSpace();
}
} Just thought about this, maybe the following would work: totalTickets: '<numberBetween(150, <($venue->maxSpace)>)>' |
@cierzniak sorry to come back a bit late on it, I think #648 (comment) should work on it, the error you get:
Seems to indicate there is no getter for that value |
Stupid of me: I assumed it was in 3.x but it works fine there, it's a problem of 2.x which doesn't support the |
I have system to organize events and for testing purposes i need to make fixtures with few inheritances of one entity. How to make it possible to eg. get one enttiy and use it multiple times in second?
When I check it by SQL:
I have eg. 40 records shown (so max tickets is more than max space in venue).
The text was updated successfully, but these errors were encountered: