Extbase Repository objectType = NULL

时间:2015-06-15 14:39:17

标签: typo3 extbase

We are migrating a 4.5 Extension to 7.2. One special case is strange. Trying to get a findOneByUid brings a "No class name was given to retrieve the Data Map for." Error.

Accessing via another object and using the DebuggerUtility it allows us to navigate to the object that fails, and there we can see, the objectType is NULL.

Any clue where to search? All the other objects can be accessed via findOneByUid.

Why is componentRepository objectType = NULL?

How would you proceed to find the issue?

2 个答案:

答案 0 :(得分:0)

添加以下行解决了问题......任何想法如何避免这种情况?

public function __construct() { $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $this->objectType = \TYPO3\CMS\Core\Utility\ClassNamingUtility::translateRepositoryNameToModelName($this->getRepositoryClassName()); }

答案 1 :(得分:0)

如果存储库的构造函数已在子类中重写而未调用父构造函数,则对象类型只能为nullparent::__construct();

您应该使用方法initializeObject,而不是使用构造函数,该方法在构造函数之后被调用,并且可以安全地被覆盖。

相关问题