[TYPO3-mvc] Extbase & static countries: link not by uid but by isocode

Stefano Cecere scecere at krur.com
Thu Mar 1 13:06:04 CET 2012


hi

i'm linking custom models to countries using the standard  
static_info_tables + static_info_tables_extbase


it works correctly (i get the country short code in Fluid with  
{mymodel.countrynum.shortName} IF i make the link using the uid of the  
country:

SQL:
	countrynum int(11) unsigned DEFAULT '0' NOT NULL,
TCA:
	'countrynum' => array(
		'config' => array(
			'type' => 'select',
			'foreign_table' => 'static_countries',
	
Model:
	/**
	 * Returns the countrynum
	 *
	 * @return Tx_StaticInfoTablesExtbase_Domain_Model_StaticCountry $country
	 */
	public function getCountrynum() {
		return $this->countrynum;
	}


BUT since it's an enterprise project, i would like to keep all the  
relations with iso tables usign iso codes..
so not the uid, but the cn_iso_3 field, for example


so i make:
SQL:
	country char(3) DEFAULT '' NOT NULL,
TCA:
	'country' => array(
		'config' => array(
			'type' => 'select',
			'itemsProcFunc' => 'tx_staticinfotables_div->selectItemsTCA',
			'itemsProcFunc_config' => array(
				'table' => 'static_countries',
				'indexField' => 'cn_iso_3',
			),

Model:
	/**
	 * Returns the country
	 *
	 * @return Tx_StaticInfoTablesExtbase_Domain_Model_StaticCountry $country
	 */
	public function getCountry() {
		return $this->country;
	}


but in this way i get nothing..
so i guess that Extbase uses uids by default, and it doesn't understand  
the linking with another index

QUESTION:

how can i configure the persistence model of static_countries to say  
Extbase: the links are using the cn_iso_3 field and not the uid ?


any help would be very useful (i guess not only for me!)

thank you



-- 
____    ___   __  _ ______________________

   Stefano Cecere
   KRUR studio


More information about the TYPO3-project-typo3v4mvc mailing list