[TYPO3-mvc] f:form.select is not saved

Christian Kartnig office at hahnepeter.de
Thu Mar 17 08:21:05 CET 2011


Hi!

Thanks for answering! This is really bugging me.
Here are the declaration, setter, TCA and SQL for the country relation. 
These are all generated by the kickstarter and I can't see why it should 
not work out. Can you have a look, please?

best regards,
Christian


/**
  * country
  *
  * @var Tx_Top1001_Domain_Model_Country
  */
protected $country;


/**
  * Sets the country
  *
  * @param Tx_Top1001_Domain_Model_Country $country
  * @return void
  */
public function setCountry($country) {
	$this->country = $country;
}


'country' => array(
	'exclude'	=> 0,
	'label'		=> 
'LLL:EXT:top1001/Resources/Private/Language/locallang_db.xml:tx_top1001_domain_model_company.country',
	'config'	=> array(
		'type' => 'select',
		'foreign_table' => 'tx_top1001_domain_model_country',
		'minitems' => 0,
		'maxitems' => 1,
		'wizards' => array(
			'_PADDING' => 1,
			'_VERTICAL' => 0,
			'edit' => array(
				'type' => 'popup',
				'title' => 'Edit',
				'script' => 'wizard_edit.php',
				'icon' => 'edit2.gif',
				'popup_onlyOpenIfSelected' => 1,
				'JSopenParams' => 
'height=350,width=580,status=0,menubar=0,scrollbars=1',
				),
			'add' => Array(
				'type' => 'script',
				'title' => 'Create new',
				'icon' => 'add.gif',
				'params' => array(
					'table'=>'tx_top1001_domain_model_country',
					'pid' => '###CURRENT_PID###',
					'setValue' => 'prepend'
					),
				'script' => 'wizard_add.php',
			),
		),
	),
),


CREATE TABLE tx_top1001_domain_model_company (
	[...]
	country int(11) unsigned DEFAULT '0',
)



Am 14.03.2011 10:38, schrieb Franz Koch:
> Hey,
>
>> Thanks for answering, Franz!
>> Yes, an 1:1 relationship works well. Still the problem described is
>> there. The reference to the country is not saved, unless I set the uid
>> like this:
>>
>> $countryUid = $company->getCountry()->getUid();
>> $company->setCountry($countryUid);
>
> This should actually give you a exception or php error unless your
> setCountry method expects an integer and not a country object. How does
> your setCountry method look like (including comments) and how is the
> country property declared (also including comments)?
>



More information about the TYPO3-project-typo3v4mvc mailing list