[Flow] The given object is unknown to the Persistence Manager > forward a request with empty object as parameter
Axel Wüstemann
awu at qbus.de
Mon Nov 11 14:02:12 CET 2013
Hi there,
I have this scenario:
I have an form in new or editAtion with an object that has a OneToMany
relation: the parent object extended by fields, ordered into rows for
the child objects.
Initially, in newAction I give 5 empty children, so the user can fill
them. In both, at new and editAction, there is a button by wich the user
can add more rows for children.
If this button is pressed, I switch the form action of the new/editForm
from 'create/update' to 'addField' using jQuery.
In the addField action I add the appropriate count of empty child
objects the user requested. Then I forward to where I came from.
With edit this works fine, with new I get the error: "The given object
is unknown to the Persistence Manager".
Yes, the object has never been persisted before. How can I treat with that?
1. Is there a solution within Flow to allow forwarding empty objects?
or alternatively
2.Do I need to store this object first an then forward to the update
action, instead back to newAction?
But the 2. seems also to bring me up some trouble.
If I do
$this->fooRepository->add($bar);
before forwarding back to the newAction (or even editAction), I will get
"The identity property "74872" is neither a string nor an array."
Thank you for any hint
Axel
More information about the Flow
mailing list