这是我的控制器动作:TYPO3 Extbase JsonView FAL
public function jsonAction()
{
$this->view->setVariablesToRender(array('produkte'));
$this->view->setConfiguration(
array(
'produkte' => array(
'_descendAll' => array(
'only' => array('titel', 'beschreibung', 'bild', 'download', 'categories'),
'_descend' => array(
'bild' => array(),
'download' => array(),
'categories' => array(),
)
)
)
)
);
$this->view->assign('produkte', $this->produktRepository->findAll());
}
,我得到一个非常好的JSON字符串。不幸的是,我只能得到包含文件(FAL)的PID和UID。我如何获得完整的对象或至少包含文件的路径?
/**
* Returns the bild
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $bild
*/
public function getBild()
{
return $this->bild;
}
/**
* Returns the download
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $download
*/
public function getDownload()
{
return $this->download;
}
您是否可以分享Produkt的相关型号零件? – lorenz
好的,上面编辑。希望它是正确的部分。 – hydrococcus
我怀疑这必须与文件和文件引用对象的属性不是真正的对象属性,但存储为延迟加载关联数组(我认为名为'属性')。 'JsonView'只处理通过调用'get_object_vars'(通过调用[getGettablePropertyNames()](https://typo3.org/api/typo3cms/_object_access_8php_source.html#l00232))获得的结果,该结构使用' get_object_vars'。尝试输出属性'属性',也许有帮助?不知道这是否正确。 – Jost