doctrine-extensions / DoctrineExtensions

Doctrine2 behavioral extensions, Translatable, Sluggable, Tree-NestedSet, Timestampable, Loggable, Sortable
MIT License
4.03k stars 1.27k forks source link

SoftDeleteableFilter::addFilterCriteria incompatible with BsonFilter::addFilterCriteria #2133

Closed nkanzari closed 4 years ago

nkanzari commented 4 years ago

I'm using php7.4 on Centos 7 and Symfony 4.4. Moving from ODM V1.2 to V2 and when I run the composer update I get the following error.

PHP Fatal error: Declaration of Gedmo\SoftDeleteable\Filter\ODM\SoftDeleteableFilter::addFilterCriteria(Doctrine\ODM\MongoDB\Mapping\ClassMetadata $targetEntity) must be compatible with Doctrine\ODM\MongoDB\Query\Filter\BsonFilter::addFilterCriteria(Doctrine\ODM\MongoDB\Mapping\ClassMetadata $class): array in /var/www/pricing-engine/vendor/gedmo/doctrine-extensions/lib/Gedmo/SoftDeleteable/Filter/ODM/SoftDeleteableFilter.php on line 22

It's solved by adding the output hint ":array" to function SoftDeleteableFilter in class Gedmo\SoftDeleteable\Filter\ODM\SoftDeleteableFilter line 22

public function addFilterCriteria(ClassMetadata $targetEntity) :array

AkenRoberts commented 4 years ago

ODM 2.0 support has been added to master for an eventual 3.0 release. If you'd like to try it, change your composer.json version requirement to 3.0-dev, and please share any issues you find!