Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 使用extbase和FAL扩展多个图像_Typo3_Extbase - Fatal编程技术网

Typo3 使用extbase和FAL扩展多个图像

Typo3 使用extbase和FAL扩展多个图像,typo3,extbase,Typo3,Extbase,我正在使用extension builder进行一个小型扩展,它有两个模型、公司和类别。每一个都有一个图像场,理论上,该图像场应该容纳一个或多个图像。我如下所述,并将getImage()函数定义为ObjectStorage,如下所示: /** * mypictures * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference&

我正在使用extension builder进行一个小型扩展,它有两个模型、公司和类别。每一个都有一个图像场,理论上,该图像场应该容纳一个或多个图像。我如下所述,并将getImage()函数定义为ObjectStorage,如下所示:

    /**
     * mypictures
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
     */
    protected $mypictures;

   /**
    * Returns mypictures
    *
    * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $postpictures
    */
    public function getMypictures() {
        return $this->mypictures;
    }
/**
*我的照片
*@var\TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
受保护的$mypictures;
/**
*返回我的图片
*
*@return\TYPO3\CMS\Extbase\Persistence\ObjectStorage$postpictures
*/
公共函数getMypictures(){
返回$this->mypictures;
}
但是页面只加载了大约30秒,然后什么也没打印出来。有人知道我做错了什么吗


编辑:超时问题消失了。现在它说:“ForViewHelper只支持实现\Traversable interface的数组和对象”

也许您提供的代码片段中缺少它,但您必须在模型中初始化存储对象:

public function __construct() {
    // Do not remove the next line: It would break the functionality
    $this->initStorageObjects();
}

/**
 * Initializes all ObjectStorage properties
 *
 * @return void
 */
protected function initStorageObjects() {
    $this->mypictures = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}

然后,清除系统缓存并重试。

请提供控制器操作和视图(流体模板)的代码片段