[TYPO3-mvc] The value must be of type "Extension_model_name", but was of type "NULL".

Daniel Dimitrov danielsd_bg at yahoo.fr
Tue Jul 27 12:56:34 CEST 2010


Hi again :)
Now that my extension is showing the products in frontend it is time to make 
some forms and save data into the database :)
I'm following the blog example, but something strange happens.

I've created the same methods as in the Blog controller:

	/**
	 * Displays a form for creating a new Product
	 *
	 * @param Tx_BwShop_Domain_Model_Product $newProduct A fresh product object 
taken as a basis for the rendering
	 * @return string An HTML form for creating a new blog
	 * @dontvalidate $newProduct
	 */
	public function newAction(Tx_BwShop_Domain_Model_Product $newProduct = 
NULL) {
		$this->view->assign('newProduct', $newProduct);

	}

		/**
	 * Creates a new blog
	 *
	 * @param Tx_BwShop_Domain_Model_Product $newProduct A fresh Product object 
which has not yet been added to the repository
	 * @return void
	 */
	public function createAction(Tx_BwShop_Domain_Model_Product $newProduct){
		die('create');
	}

The new action shows the form:
<f:form method="post" controller="Product" action="create" name="newProduct" 
object="{newProduct}">
	<f:form.textbox property="title" />
	<f:form.submit class="submit" value="Submit"/>
</f:form>

When I enter something for title and click submit I get this:

Tx_Extbase_MVC_Exception_InvalidArgumentValue
The value must be of type "Tx_BwShop_Domain_Model_Product", but was of type 
"NULL".


I've read a thread on the list about this exception: 
Tx_Extbase_MVC_Exception_InvalidArgumentValue
and it was suggesting that I have to set a storagePid - I have this in my 
TypoScript:
constants.txt:
plugin.tx_bwshop {
	persistence {
		 # cat=plugin.tx_bwshop//a; type=int+; label=Default storage PID
		storagePid = 47448, 93
	}
}


setup.txt:
 # Plugin configuration
plugin.tx_bwshop {
	settings {
		itemsPerPage = 10
		pidCatStorage = 93
		indexSearchPage = rl1_153
	}
	persistence {
		storagePid = {$plugin.tx_bwshop.persistence.storagePid}
		classes {
			Tx_BwShop_Domain_Model_Keyword.mapping.tableName = tx_bwkeywords
		}
	}
}

Any ideas what could be wrong with this?
Kind Regards,
Daniel



 



More information about the TYPO3-project-typo3v4mvc mailing list