[TYPO3-mvc] Tx_Extbase_Persistence_Repository->add() does notwork

Alexander Dick alex at dick.at
Tue Sep 14 11:24:01 CEST 2010


Thank you so much! 

Now the query hits the database. But why do I have to explicitly persist it? Is it because I have no redirect? 

Unfortunately I get a SQL error now: 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '), additional_items='a:0:{}', covers='a:2:{i:1;s:9:\"test test\";i:2;s:0:\"\";}'' at line 1 

I want to save a serialized array to some fields. Seems like it does not get properly escaped from extbase or am I missing something? 

getter/setter in my Model: 

	/**
	 * @var array
	 */
	protected $additionalItems = array(); 

	/**
	 * @return array
	 */
	public function getAdditionalItems() {
		return unserialize($this->additionalItems);
	}
		
	/**
	 * @param array
	 */
	public function setAdditionalItems($val) {
		$this->additionalItems = serialize($val);
	}


kidn regards
Alex


On Tue, 14 Sep 2010 10:49:57 +0200, "Thomas \"Thasmo\" Deinhamer" <thasmo at gmail.com> wrote:
> Am 14.09.2010 10:25, schrieb Alexander Dick:
>> I really have no idea what's wrong. Please someone help me.
> 
> Do you redirect after you use "add"?
> Not sure, but I've encountered, that some things don't get saved
> if you redirect, because then the persistance is not done and you
> need to do it manually.
> 
> Try this after tyou added the object:
> 
> $persistenceManager =
> t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
> $persistenceManager->persistAll();
> 
> Regards,
> Thomas
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list