[FLOW3-general] Object argument becomes null

Scott MacDonald smacdav at gmail.com
Sun Jul 25 18:16:03 CEST 2010


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


More information about the FLOW3-general mailing list