[FLOW3-general] Object argument becomes null
Scott MacDonald
smacdav at gmail.com
Sun Jul 25 18:25:29 CEST 2010
I should clarify that the reason there's a separate create action and
edit action is that ultimately there will be two types of create
actions: one for manually creating a disc and entering tracks and one
for contacting a web service to retrieve the tracks. Both create actions
will need to redirect to the edit action in the end.
On or about 7/25/2010 12:16 PM, Scott MacDonald said:
> I saw an earlier thread that seemed to be similar to this but there
> were few details and it wasn't resolved.
>
> I completed the flow3 1.0.0 alpha 7 tutorial on the web site then
> downloaded flow3 1.0.0 alpha 10 to work on my own project. In my
> project, I have a Disc object in the model:
>
> <?php
> declare(ENCODING = 'utf-8');
> namespace F3\TrackLibrary_PHP\Domain\Model;
>
> /**
> * A disc
> *
> * @scope prototype
> * @entity
> */
> class Disc {...
>
> In DiscController.php, I have a create action and an edit action:
>
> /**
> * Creates a new disc
> *
> * @param \F3\TrackLibrary_PHP\Domain\Model\Disc $disc A fresh
> Disc object which has not yet been added to the repository
> * @return void
> */
> public function
> createAction(\F3\TrackLibrary_PHP\Domain\Model\Disc $disc) {
> $this->discRepository->add($disc);
> $this->disc = $disc;
> $this->redirect('edit', \NULL, \NULL, array('disc' => $disc));
> }
>
> /**
> * Edit a disc
> *
> * @param \F3\TrackLibrary_PHP\Domain\Model\Disc $disc
> * @return string
> */
> public function editAction(\F3\TrackLibrary_PHP\Domain\Model\Disc
> $disc) {...
>
> The first two lines in createAction are things I put in there while
> debugging in order to confirm the issue. The code of editAction
> doesn't matter because I never get there. The problem is that the
> $disc argument passed to editAction is NULL. Running a debugger, I
> found that those first two lines of createAction don't stick: if I get
> rid of the argument for editAction in order to get it to execute,
> $this->disc is NULL and $this->discRepository is empty once I enter
> editAction.
>
> Can anyone see what I'm doing wrong? I'm happy to provide more
> details, if needed.
>
> Thanks,
>
> Scott
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>
More information about the FLOW3-general
mailing list