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
Stories ignore persistenceless factories #588
Comments
Hi @Fabrn I don't fully understand what you're trying to achieve: without Doctrine, the objects which are created in a story are not persisted at all (moreover in a global state). They are not "stored" anywhere, where you could retrieve them. At first, I thought your issue was the same than #573 but they are adding a
When |
Hello ! Thanks for your quick answer 😄
My goal was to store non-persistent Proxies into the Story states in order to retrieve them later in the code.
My bad, didn't check what was happening under the hood there. However, the bit of code that persists the Proxies happens to be called while adding a state to the Story ( |
whoops, you're right stories do keep their own states, the other part of the issue misguided me: I thought you wanted to access from So I guess this PR does what you need? |
Well I guess this PR does the job indeed 😄 I wonder if it wouldn't have been cleaner to check if the |
Hello there !
Context
In order to explain the full thinking process and how I was led here, I need to explain what I want to achieve : my goal is, since I am working on an app that does not work properly, I need to create items with their ID pre-defined. In order to do so, I tried to define the identifier in the attributes of the item I was creating. Sadly, Doctrine seems to overlap the ID whatever.
Being blocked by the Doctrine behavior, after analysing the situation, I thought "why not trying without persistence", so I would be done with Doctrine, and should be able to retrieve my elements.
By the way, my elements are created in a Story using Story states like so :
Issue
Then, I put my story in the
global_state
configuration so it would load automatically. And then, at the very beginning of my teams, I debuggedMyFactory::all()
and saw that every items had their ID reset, and most importantly, thepersisted
boolean was set totrue
, which means that the Story ignored this :Also, I confirm that loading the Story manually creates the same problem, and creating an item using
MyFactory::createOne
created a non-persisted Proxy.Solution
After some research, I found this bit of code in the
Story::normalizeObject
method at line 189 :Is this an intended behavior ? If yes, shouldn't it check if persistence is enabled for the Factory ? Why the Story whould essentially need the Proxies to be persisted ?
Maybe there is something I didn't get which explains it all and it's fine 😄
The text was updated successfully, but these errors were encountered: