Sylius: Incompatible CustomerRepository count() method declaration

Created on 10 Sep 2017  路  6Comments  路  Source: Sylius/Sylius

Looks like the count method of CustomerRepository overrides the Doctrine\ORM\EntityRepository::count(array $criteria) which throws below error while trying to use the repository:

Warning: Declaration of Sylius\Bundle\CoreBundle\Doctrine\ORM\CustomerRepository::count(): int should be compatible with Doctrine\ORM\EntityRepository::count(array $criteria)

Renaming the method to countCustomers() should fix the problem.

RFC

Most helpful comment

I would say the more you can upgrade before 1.0, the better. Saves BC issues afterwards. The upgrade from beta.3 to 1.0 is already full of BC, so a bit more won't harm anyone ;-)

All 6 comments

Which version of Doctrine do you use? Current version in our composer.lock is 2.5.6 and there is not such method in Doctrine\ORM\EntityRepository for this version 馃槃

See https://github.com/doctrine/doctrine2/pull/6003 - it'll be part of ORM 2.6

馃憤 the question is - should we fix something (with BC break, btw) what is not bug yet. I think we can leave it as it is and take care about it when we'll upgrade to doctrine 2.6. /cc @Sylius/core-team

Personally I'd do it now otherwise dependent on how strict you are on B/C you possibly lock to ORM 2.5 until Sylius 2.0.

I would say the more you can upgrade before 1.0, the better. Saves BC issues afterwards. The upgrade from beta.3 to 1.0 is already full of BC, so a bit more won't harm anyone ;-)

We could also try not to extend EntityRepository in our own repositories :)

Was this page helpful?
0 / 5 - 0 ratings