[FLOW3-general] Access fluid form object

Thomas Plessis t.plessis at totemnumerique.com
Wed Jan 11 17:23:26 CET 2012


I've changed my two actions method like you said :

	/**
	 * Shows a form for creating a new item object
	 *
	 * @param \Totem\Lewin\Domain\Model\Item $newItem A new item to add
	 * @return void
	 * 
	 * @FLOW3\IgnoreValidation("$newItem")
	 */
	public function newAction(Item $newItem=NULL) {


	/**
	 * Adds the given new item object to the item repository
	 *
	 * @param \Totem\Lewin\Domain\Model\Item $newItem A new item to add
	 * @return void
	 * 
	 */
	public function createAction(Item $newItem) {

But nothing in paperers on form error validation. I've notice that in \TYPO3\FLOW3\MVC\Controller\ActionController line 406, $referringRequest->getArguments() is empty. Is that normal?

regards,

Thomas Plessis
Développeur multimédia
--
TOTEMnumerique
9, Place St Étienne
31000 Toulouse
T. 05 61 14 64 54
F. 05 61 14 64 55

Le 11 janv. 2012 à 13:54, Christian Müller (Kitsunet) a écrit :

> Right, and for this action (which is called in the error case too) you should expect the $newItem argument too:
> 
> public function newAction(\Totem\Lewin\Domain\Model\Item $newItem = NULL) {
> 
> (and don't forget to update the annotation)
> 
> And if you move the validation to the model you should also annotate IgnoreValidation to the method. Finally assign the newItem to your template. It will either be NULL (if first call to the action) or filled with a non validated, possibly incomplete model object, but you can reuse the entered values that way.
> 
> Cheers,
> Christian
> 
> 
> 
> On 11/01/12 11:34, Thomas Plessis wrote:
>> For validator, yes you're right, i can move them to model. And yes, i've another action to display the form :
>> 
>> 	/**
>> 	 * Show a form for creating a new item object
>> 	 *
>> 	 * @return void
>> 	 */
>> 	public function newAction() {
>> 		// Orders all regions by label ASC and assign them to the view
>> 		$this->regionRepository->setDefaultOrderings(array('label' =>  \TYPO3\FLOW3\Persistence\QueryInterface::ORDER_ASCENDING));
>> 		$this->view->assign('regions', $this->regionRepository->findAll());
>> 		$this->view->assign('itemCategories', $this->categoryRepository->findCategoriesAsSelect());
>> 	}
>> 
> _______________________________________________
> 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