Bug #77106

Error in TYPO3\CMS\Extbase\Domain\Model\FileReference::setOriginalResource caused by incompatible Declaration

Added by Dirk Wenzel over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-07-15
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
On Location Sprint

Description

While running unit test for a model with file references I got the following error

./bin/phpunit -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/t3events/Tests/Unit/
PHPUnit 4.8.13 by Sebastian Bergmann and contributors.
[...]

There was 1 error:

1) Webfox\T3events\Tests\Unit\Domain\Model\PersonTest::imageCanBeAdded
Declaration of TYPO3\CMS\Extbase\Domain\Model\FileReference::setOriginalResource(TYPO3\CMS\Core\Resource\FileReference $originalResource) 
should be compatible with TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder::setOriginalResource(TYPO3\CMS\Core\Resource\ResourceInterface $originalResource)

/home/vagrant/UnitTests/typo3/sysext/extbase/Classes/Domain/Model/FileReference.php:22
/home/vagrant/UnitTests/vendor/typo3/class-alias-loader/src/ClassAliasLoader.php:130
/home/vagrant/UnitTests/vendor/typo3/class-alias-loader/src/ClassAliasLoader.php:169
/home/vagrant/UnitTests/vendor/typo3/class-alias-loader/src/ClassAliasLoader.php:120
/home/vagrant/UnitTests/typo3conf/ext/t3events/Tests/Unit/Domain/Model/PersonTest.php:394
/home/vagrant/UnitTests/vendor/phpunit/phpunit/phpunit:47

Model (Extract):

<?php
namespace Webfox\T3events\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;

class Person extends AbstractEntity {

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

    /**
     *
     */
    public function initializeObject() {
        $this->images = new ObjectStorage();
    }

    /**
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
     */
    public function getImages()
    {
        return $this->images;
    }

    /**
     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
     */
    public function setImages($images)
    {
        $this->images = $images;
    }

    /**
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileReference
     */
    public function addImage(FileReference $fileReference) {
        $this->images->attach($fileReference);
    }

    /**
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileReference
     */
    public function removeImage(FileReference $fileReference) {
        $this->images->detach($fileReference);
    }
}

History

#1 Updated by Nicole Cordes over 3 years ago

  • Assignee set to Nicole Cordes

#2 Updated by Nicole Cordes over 3 years ago

  • Sprint Focus set to On Location Sprint

#3 Updated by Johannes Goslar over 3 years ago

This seems to be fixed with https://review.typo3.org/#/c/46228/
Which branch/commit are you running?

#4 Updated by Nicole Cordes over 3 years ago

  • Status changed from New to Needs Feedback

#5 Updated by Riccardo De Contardi about 3 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Nicole Cordes)

90 days without feedback -> closing it.

If you think that this is the wrong decision or experience this issue again please reopen it or open a new issue with a reference to this one.

Thank you.

#6 Updated by CPS-IT GmbH about 3 years ago

I could not reproduce the issue under TYPO3 version 8.3.1 - so it can be closed.

Thank you!

Also available in: Atom PDF