[FLOW3-general] Object argument becomes null

Scott MacDonald smacdav at gmail.com
Mon Jul 26 14:03:05 CEST 2010


Thanks for the help, guys. Unfortunately, it doesn't work. Here's what 
happened when I tried various things:

Sebastian said:
> 2) When doing the redirect, the system notices that $disc is an instance
> of ...Domain\Model\Disc, and sees that it is an entity. That's why it
> tries to convert it to a UUID (as that is what would happen when a
> normal URL is generated). However, as it does not have a UUID yet
> (because it is not yet persisted), this fails.
>
> ...
>
> 1) Just call $this->editAction(...) if this makes sense, or extract the
> common logic into a separate method.
>    
Actually, it seems to generate a UUID just fine (from tracing it via the 
debugger), but the UUID winds up referring to nothing in the end.

Calling $this->editAction() technically works, though now it is looking 
for a template attached to the create action. I could use this as a 
workaround, but since in the end there will be two create actions 
leading to a common edit screen, it seems like it would be cleaner to 
have the edit action call the appropriate view.

Bastian said:
> AFAIK it should work when you use forward() instead, as that won't to 
> a HTTP redirect but basically call the new action "directly".
>
> To work around this issue with redirect(), you can persist the object 
> explicitly by calling the persistAll() method of the 
> PersistenceManager before redirecting.
Changing redirect() to forward() made no difference: $disc is still NULL 
when it gets to the edit action.

To use the PersistenceManager, I injected one into the controller and 
placed a call to $this->persistenceManager->persistAll(); right before 
the redirect. All I got was a blank screen with the URI showing that it 
hadn't moved past the create action, so I ran the debugger and found 
that it stopped executing after the call to persistAll(). (I assume that 
the blank screen at that point is because there is no template set to 
display for that action; please correct me if I'm wrong.) Did I make the 
call wrong?

Thanks again,

Scott


More information about the FLOW3-general mailing list