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

Upgrade 2.x to 3.x issues #923

Closed
benr77 opened this issue May 6, 2018 · 4 comments
Closed

Upgrade 2.x to 3.x issues #923

benr77 opened this issue May 6, 2018 · 4 comments
Labels
Milestone

Comments

@benr77
Copy link

benr77 commented May 6, 2018

I've encountered a couple of issues when upgrading to 3.x. Can anybody clarify if there is a workaround to the following, which worked in 2.x and now do not appear to be functional in 3.x.

ISSUE 1 - access to entity properties

Accessing a private property seems to have stopped working. The ID is the primary key from the database, so required the @myEntity1 to have been persisted before the ID will return a non-null value

value: '@myEntity1->id'

I have tried custom ordering of the entities to ensure this statement comes after the one that defines @myentity, but this appears to make no difference. Is this due to the removal of the persistence layer?

ISSUE 2 - combining a function with a reference

In 3.x the following appears to have stopped working

AppBundle\Entity\Booking:
  booking{1..26}:
    bookingStatus: '80%? @bookingStatus2 : @bookingStatus<numberBetween(1, 7)>'

I have had to replace @bookingStatus<numberBetween(1, 7)> with simply @bookingStatus5 but this won't give me the random spread I'm looking for.

Thanks

@theofidry
Copy link
Member

Accessing a private property seems to have stopped working

This is on purpose although it doesn't appear to be documented in https://github.com/nelmio/alice/blob/master/UPGRADE.md :/ It is still possible but I don't want it as a default: https://github.com/nelmio/alice/blob/master/doc/advanced-guide.md#custom-accessor

The 2nd issue sounds legit

@theofidry theofidry added the Bug label May 6, 2018
@theofidry theofidry added this to the 3.x milestone May 6, 2018
@benr77
Copy link
Author

benr77 commented May 6, 2018

Accessing a private property seems to have stopped working

Will this be able to access the ID generated as the primary key when the entity is persisted? Or do I need to try and set the ID in the fixture and then use one of the Custom Accessor methods to set it?

@theofidry
Copy link
Member

Sorry for the late reply I didn't see your question. Doctrine is able to access to the ID as usual (it's a doctrine thing, not alice). You can also manually set the ID but then you should set it for all the fixtures of that class (this is only possible by manipulating the Doctrine class metadata, which is configurable for the whole class only, not specific instances).

Note however that accessing an auto-generated ID in the fixtures directly is not possible since all the fixtures are persisted together at the same time.

@theofidry
Copy link
Member

°1 and °2 being a sub-task of #601, I'll close this issue :)

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