[TYPO3-mvc] validate in create action and redirect to new action?

Daniel Dimitrov danielsd_bg at yahoo.fr
Thu Aug 12 12:44:45 CEST 2010


Hey Guys,
In my createAction I am making some small calculations. I get the some of 
the $_POST data that is not mapped to the object I want to save, transform 
it and then set it as object properties.

Here is a small example:
	public function createProductAction(Tx_BwShop_Domain_Model_Product 
$newProduct) {

		$cat = Tx_BwShop_Helper_Utilities::getParametersSafely('cat', 
$this->request);

                                // small validation
                                 if(count($cat) > 3) {
//			$this->forward('newProduct');
		} else {
                                            $newProduct->setCat1($cat[1]);
                                            $newProduct->setCat1($cat[2]);
                                            $newProduct->setCat1($cat[3]);
                                }

                                //persist the object now
	}


now the problem I have with this forward action to the newProductAction is 
that when it is called - the form is empty.
$this->forward('newProduct',NULL,NULL,array('newProduct'=>$newProduct);
generates an extbase error message...

I tried $this->newProductAction($newProduct), but this doesn't change the 
view...
How can I call my newProductAction with an argument?

Kind regards,
Daniel 



More information about the TYPO3-project-typo3v4mvc mailing list