在null上调用成员函数createQueryForType() - 异常

时间:2017-03-14 09:53:02

标签: typo3 extbase typo3-6.2.x

我关注Creating a first extension,但我收到了500错误,并且:

  

[Tue Mar 14 09:45:42 2017] [warn] mod_fcgid:stderr:PHP致命错误:
  在第251行的/var/typo3_src/typo3_src-6.2.29/typo3/sysext/extbase/Classes/Persistence/Repository.php中调用null上的成员函数createQueryForType()

服务器PHP 5.6和Typo3 6.2.29

存储库代码:

<?php
namespace MyVendor\MyExt\Domain\Repository;

use \TYPO3\CMS\Extbase\Persistence\Repository;

class UserRepository extends Repository {
    public function __construct() {
    }
}

控制器操作:

public function getOnlineUsersAction() {
    $userRepository = GeneralUtility::makeInstance(UserRepository::class);
    $users = $userRepository->findAll();
    // todo
}

1 个答案:

答案 0 :(得分:1)

尝试:

存储库代码:

var id = "'" + scope.pageContent.content[i].id + "'";

控制器代码:

<?php
namespace MyVendor\MyExt\Domain\Repository;

use \TYPO3\CMS\Extbase\Persistence\Repository;

class UserRepository extends Repository {
    // Remove the __construct (or add parent::__construct)
}