[TYPO3-mvc] Accessing category relations for a page

Mathias Bolt Lesniak, LiliO Design mathias at lilio.com
Thu Jun 12 14:19:20 CEST 2014


Hi!

In TYPO3 6.2.3 I’m trying to get the categories related to a specific page, using the sys_category records. I have created a Page model with the field ‘categories', but I keep getting this exception:

****
#1234386924: Cannot create empty instance of the class "TYPO3\CMS\Extbase\Persistence\ObjectStorage" because it does not implement the TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface. (More information)

TYPO3\CMS\Extbase\Object\Exception\CannotReconstituteObjectException thrown in file
/Volumes/Data/Users/mathias/ApacheSites/typo3_src-6.2.3/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php in line 169.
****

The mapper is actually trying to fill the Category object data into the ObjectStorage object!

From what I can see, my Page class is correctly defining the “category” property:

****
	/**
	 * Categories
	 *
	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category>
	 */
	protected $categories;
****

(I picked the code from the 6.0 release notes at http://wiki.typo3.org/TYPO3_6.0)

Not that it matters much. Removing the doc comment has no effect. The same exception occurs even if I just write this:

****
	protected $categories;
****

Apart from this, the class maps nicely to the pages table. Removing the $categories property also removes the exception.

What am I doing wrong? Any good ideas?


Best wishes

Mathias Bolt Lesniak
LiliO - www.lilio.no
mathias at lilio.com


More information about the TYPO3-project-typo3v4mvc mailing list