Project

General

Profile

Actions

Bug #65061

closed

AbstractFileCollection @var mixed causes Exception #1315564744

Added by Viktor Livakivskyi almost 10 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-02-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

We have a domain model Device, which connects list of StaticFileCollection records:

/**
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\StaticFileCollection>
 * @lazy
 */
protected $mediaHub;

A controller, that shows a Device

DeviceController->showAction(Device $device)

In TYPO3 < 6.2 all was fine, because no recursive validation was taking place, but since 6.2 the following Exception is thrown:

#1315564744: @var annotation of Found an invalid element type declaration in class "TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection", property "itemsCriteria". A type "'mixed'" does not exist.

And is caused by AbstractFileCollection:

/**
 * Field contents of $itemsCriteriaField. Defines which the items or search criteria for the items
 * depending on the type (see self::$type above) of this file collection.
 *
 * @var mixed
 */
protected $itemsCriteria;

Now this is solved by XCLASSing AbstractFileCollection and adding in xlcass this method:

public function __toString() { return __CLASS__; }

TYPO3 6.2.9

Actions #1

Updated by Viktor Livakivskyi over 9 years ago

Remark and update on this topic: we intended to use XCLASS to overload AbstractFileCollection, but in fact it was not possible (maybe, becasue it is an abstract class or it is instantiated differently), so the solution was to copy-paste (yep, dirty) it and overload with ext_autoload.php

<?php
return array (
  'TYPO3\\CMS\\Core\\Resource\\Collection\\AbstractFileCollection' => PATH_site. 'path/to/custom/AbstractFileCollection.php',
);
?>

And this worked fine until T3 6.2.10, which introduced PSR-4 loading of Core classes via Composer. It doesn't work on 6.2.11 either.
At the moment of writing we're not able to find an easy way to workaround it. As result, we're blocked to further updates on 6.2.x.

So, the issue is critical.

Actions #2

Updated by Riccardo De Contardi over 8 years ago

  • Status changed from New to Needs Feedback

This report seems quite old.. does the issue still occurs on 6.2.22 or latest master? Thank you!

Actions #3

Updated by Viktor Livakivskyi over 8 years ago

Hi, tried again with 6.2.25 - issue still persists.

Didn't try on 7.x or 8.x, but since $itemsCriteria is still annotated as "mixed" in TYPO3 7 LTS, I assume the issue may still be there.

Actions #4

Updated by Riccardo De Contardi over 8 years ago

  • Status changed from Needs Feedback to New
Actions #5

Updated by Susanne Moog over 5 years ago

  • Category changed from File Abstraction Layer (FAL) to Extbase

Moving this one to extbase, as it's the extbase validation that's the problem here if I see that correctly.

Actions #6

Updated by Christian Eßl about 5 years ago

Both StaticFileCollection and AbstractFileCollection are part of ext:core and therefore don't care about extbases annotations or validations.

Apparently there are a StaticFileCollection and AbstractFileCollection model in extbase as well. Both are currently marked as "@internal experimental!" (and have been marked as that for a long time)
Maybe those both can be used and extended for using file collections in extbase models.

Actions #7

Updated by Benni Mack almost 5 years ago

  • Status changed from New to Closed

yeah, the classes are unfortunately by design in bad shape, so it's not recommende to use them directly in Extbase context. I would also follow Christian's suggestion for the time being. in TYPO3 v11, we hopefully have native type support then! Until then, use the Extbase domain models.

Actions

Also available in: Atom PDF