doyp9057 2017-10-05 05:03
浏览 37
已采纳

typo3后端扩展的createAction不会保留数据

I'm in a migration process from typo3 6.2.31 to 7.6.23

I have the following function:

public function createAction(\TYPO3\Institutsvideoverwaltung\Domain\Model\Category $newCategory) {
    $contentCat = $this->request->getArgument('newCategory');
    if ($contentCat['isRoot'] == '1') {
        $this->categoryRepository->add($newCategory);
        $this->addFlashMessage($newCategory->getName(), 'Kategorie erfolgreich angelegt!', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK);
    } else {
        if (!empty($_POST['tx_institutsvideoverwaltung_auditgarant_institutsvideoverwaltungvideoverwaltungbackend']['catAllocationUIDs'])) {
            $catAllocationUIDs = $this->request->getArgument('catAllocationUIDs');
            foreach ($catAllocationUIDs as $catAllocationUID) {
                $category = $this->categoryRepository->findByUid($catAllocationUID);
                $category->addChildCategory($newCategory);
                $this->categoryRepository->update($category);
            }
            $this->addFlashMessage($newCategory->getName(), 'Kategorie erfolgreich angelegt!', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK);
        } else {
            $this->addFlashMessage('Das Objekt wurde nicht angelegt, da keine Zuordnung erfolgt ist. Wenn es sich um kein Wurzelelement handelt, nehmen Sie zumindest eine Zuordnung vor.', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
        }
    }
    /*  }*/
    $this->redirect('list');
}

It says all works fine, but it does not persist data. What could be the problem?

When I add manually a record to databse it is not shown as well :(

Update Out Var_dump enter image description here

  • 写回答

2条回答 默认 最新

  • doushang9172 2017-10-06 09:39
    关注

    After some TeamViewer investigations we found the problem located in the the Model and in the TCA.

    The Model had the attribute protected $uid = '' . Of course the UID cannot be a string and should not be declared as this. However, the debug in the createAction said the object is a "persisted entity" and so the Persistence Manager thought there is nothing to do. After removing the $uid from the model and updating to TCA to become 7 LTS compatible, the problem was solved.

    I guess its not a problem to declare the $uid as an integer in the model but as a string it was just too much for the system. Amazing that this worked in TYPO3 6 LTS...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 有方法可以研究物种分布点与景观指数之间的关系?吗。
  • ¥15 优博讯dt50巴枪怎么提取镜像
  • ¥30 在CodBlock上用c++语言运行
  • ¥15 求C6748 IIC EEPROM程序固化烧写算法
  • ¥50 关于#php#的问题,请各位专家解答!
  • ¥15 python 3.8.0版本,安装官方库ibm_db遇到问题,提示找不到ibm_db模块。如何解决?
  • ¥15 TMUXHS4412如何防止静电,
  • ¥30 Metashape软件中如何将建模后的图像中的植被与庄稼点云删除
  • ¥20 机械振动学课后习题求解答
  • ¥15 IEC61850 客户端和服务端的通讯机制
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部