I created an extbase model and try to set the sys_language_uid field when creating a new item. For some reason though, it is completely ignored and always set to 0, even when the value I try to enter is definitely 1.
My Model looks like this:
class Ad extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* sysLanguageUid
*
* @var integer
*/
protected $sysLanguageUid;
/**
* @return int
*/
public function getSysLanguageUid()
{
return $this->sysLanguageUid;
}
/**
* @param int $sysLanguageUid
*/
public function setSysLanguageUid($sysLanguageUid)
{
$this->sysLanguageUid = $sysLanguageUid;
}
// ... etc.
}
and in my controller all I try to do is this:
$ad = new Ad();
$ad->setSysLanguageUid($GLOBALS['TSFE']->sys_language_uid);
$ad->setSomeOtherParam('xxx');
$this->adRepository->add($ad);
The other param is saved just fine. sys_language_uid exists in ext_tables.sql and in the TCA:
'columns' => array(
'sys_language_uid' => array(
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array(
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
),
),
),
'some_other_field' => ....
)
Why is setSysLanguageUid not working? Any hints?