【问题标题】:multiple images in extension using extbase and FAL使用 extbase 和 FAL 扩展多个图像
【发布时间】:2014-11-23 19:22:21
【问题描述】:

我正在使用扩展构建器制作一个小型扩展,它有两个模型、公司和类别。每个都有一个图像字段,理论上应该保存或更多图像。我关注this tutorial,并将 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;
    }

但是页面只加载了大约 30 秒,然后什么也没有打印出来。有谁知道我做错了什么?

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

【问题讨论】:

  • 请提供您的控制器动作和视图的代码sn-ps(流体模板)

标签: typo3 extbase


【解决方案1】:

也许您提供的 sn-ps 中缺少它,但您必须在模型中初始化存储对象:

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();
}

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-24
    • 2015-07-25
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 2014-08-17
    相关资源
    最近更新 更多