我有一个由调度程序运行的命令控制器(导入程序),它应该保存数据:
foreach ($items as $item){
// store it
$entry = $this->objectManager->get('STUBR\Importer\Domain\Model\Item');
$entry->setTitle($item['Title']);
$entry->setData(json_encode($item));
// manually set the storage page (defined in scheduler form)
$entry->setPid($itemStoragePid); // works
// manually set the language (defined in scheduler form)
// EDIT
// $entry->setSysLanguageUid = -1; // had typo
$entry->set_languageUid(-1); // works
// END EDIT
$this->itemRepository->add($entry);
}
虽然模型中没有设置pid和sys_language_uid,但setPid
的行为与预期相符,但setSysLanguageUid
没有。
我知道在extbase(https://github.com/ros/ros_comm/blob/kinetic-devel/clients/roscpp/rosbuild/roscpp.cmake)中使用setSysLanguageUid()有些不对劲,但我无法完全掌握这个问题。
如何手动存储到sys_language_uid列?
PS:我已经尝试https://forge.typo3.org/issues/45873,但可能我错过了一些东西答案 0 :(得分:1)
它已经解决了,我上面有一个错字
来自@Chi的解决方案https://stackoverflow.com/a/33798615/160968
/**
* languageUid
* @var int
*/
protected $languageUid;
/**
* @param int $languageUid
* @return void
*/
public function setLanguageUid($languageUid) {
$this->languageUid = $languageUid;
}
/**
* @return int
*/
public function getLanguageUid() {
return $this->languageUid;
}
然后$entry->setLanguageUid(-1);