TYPO3类型为xxx \\ yyy \\ Domain \\ Model \\ User的对象,其标识为\“ 1 \”。“

时间:2018-08-10 07:22:46

标签: typo3-8.x persistent-storage

我想将自定义FrontendUser添加到组控制器中的组(与前端组无关)。

Extbase可以通过uid找到我的组,但不能通过uid指定我的用户。

我在GroupController中的操作是:

/**
  * action addUser
  * @param \xxx\Yyy\Domain\Model\Group $group
  * @param \xxx\Yyy\Domain\Model\User $user
  *
  * @return void
  */
  public function addUserAction(\xxx\Yyy\Domain\Model\Group $group, \xxx\Yyy\Domain\Model\User $user)
  {
    $group.addUser($user);
    return "ok";

  }

我的错误例外是:

{"error":"TYPO3\\CMS\\Extbase\\Property\\Exception\\TargetNotFoundException #1297933823: Object of type xxx\\Yyy\\Domain\\Model\\User with identity \"1\" not found."
,"trace":["TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter->fetchObjectFromPersistence(2 Arguments)"
,"TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter->convertFrom(4 Arguments)"
,"TYPO3\\CMS\\Extbase\\Property\\PropertyMapper->doMapping(4 Arguments)"
,"TYPO3\\CMS\\Extbase\\Property\\PropertyMapper->convert(3 Arguments)"
,"TYPO3\\CMS\\Extbase\\Mvc\\Controller\\Argument->setValue(1 Arguments)"
,"TYPO3\\CMS\\Extbase\\Mvc\\Controller\\AbstractController->mapRequestArgumentsToControllerArguments()"
,"TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController->processRequest(2 Arguments)"
,"TYPO3\\CMS\\Extbase\\Mvc\\Dispatcher->dispatch(2 Arguments)"
,"TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler->handleRequest()"
,"TYPO3\\CMS\\Extbase\\Core\\Bootstrap->handleRequest()"
,"TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run(2 Arguments)"
,"xxx\\Yyy\\Rest\\Helper->callExtbasePlugin(6 Arguments)"
,"xxx\\Yyy\\Rest\\GroupHandler->xxx\\Yyy\\Rest\\{closure}(1 Arguments)"
,"Cundd\\Rest\\Router\\Route->process(1 Arguments)"
,"Cundd\\Rest\\Router\\Router->dispatch(1 Arguments)"
,"Cundd\\Rest\\Router\\ResultConverter->dispatch(1 Arguments)"
,"Cundd\\Rest\\Dispatcher->callHandler(1 Arguments)"
,"Cundd\\Rest\\Dispatcher->getCachedResponseOrCallHandler(2 Arguments)"
,"Cundd\\Rest\\Dispatcher->dispatch(2 Arguments)"
,"Cundd\\Rest\\Dispatcher->processRequest(2 Arguments)"
,"Cundd\\Rest\\BootstrapDispatcher->processRequest(2 Arguments)"
,"call_user_func_array(2 Arguments)"
,"TYPO3\\CMS\\Core\\Http\\Dispatcher->dispatch(2 Arguments)"
,"TYPO3\\CMS\\Frontend\\Http\\EidRequestHandler->dispatch(1 Arguments)"
,"TYPO3\\CMS\\Frontend\\Http\\EidRequestHandler->handleRequest(1 Arguments)"
,"TYPO3\\CMS\\Core\\Core\\Bootstrap->handleRequest(1 Arguments)"
,"TYPO3\\CMS\\Frontend\\Http\\Application->run()"
,"{closure}()"
,"require(1 Arguments)"]}

出于调试目的,我添加了一个initializeAction:

public function initializeAddUserAction()
  {
    return var_dump($_POST);
  }

结果是:

array(1) {
  ["tx_yyy_jsonapi"]=>
  array(4) {
    ["controller"]=>
    string(5) "Group"
    ["action"]=>
    string(7) "addUser"
    ["group"]=>
    int(1)
    ["user"]=>
    int(1)
  }
}

我在做什么错?为什么小组解决得很好而用户却不能解决?我正在将TYPO3 8.7与版本3中的其余扩展一起使用。

1 个答案:

答案 0 :(得分:0)

fe_users的字段tx_extbase_type设置为0。如果我将其设置为Tx_Yyy_User,它可以工作。所以问题是我没有区分普通的FrontendUser和自定义的前端用户。