doctrine / DoctrineMongoDBBundle

Integrates Doctrine MongoDB ODM with Symfony
http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html
MIT License
382 stars 230 forks source link

CommandDataCollector #488

Closed blixit closed 6 years ago

blixit commented 6 years ago

I'm trying to use the DoctrineMongoDBBundle with symfony4. After the bundle installation, composer require doctrine/mongodb-odm-bundle I got this error:

Compile Error: Declaration of Doctrine\Bundle\MongoDBBundle\DataCollector\CommandDataCollector::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response, ?Throwable $exception = NULL) must be compatible with Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response, ?Exception $exception = NULL)

This error can be fixed by changing Throwable by Exception.

malarzm commented 6 years ago

Indeed, the signature contains Exception for 6 years now, mind sending us a PR? :)

blixit commented 6 years ago

Indeed, the signature contains Exception for 6 years now, mind sending us a PR? :)

Of course. let me fork the project.

I'm wondering how could I check that changing interface Throwable by class \Exception won't break any other part of the code ?

alcaeus commented 6 years ago

We need to check some more classes - #484 added doctrine/coding-standard which requires using Throwable instead of Exception.

blixit commented 6 years ago

We need to check some more classes - #484 added doctrine/coding-standard which requires using Throwable instead of Exception.

Yes, that's my point. please let me know if I should send the PR.

alcaeus commented 6 years ago

Yes please! 👍

blixit commented 6 years ago

ok it's done. Here is the PR link https://github.com/doctrine/DoctrineMongoDBBundle/pull/489

jcaillot commented 4 years ago

Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface interface changed (again) with the 5.0 version !

we have got :

Symfony 4.2

public function collect(Request $request, Response $response, \Exception $exception = null); https://github.com/symfony/symfony/blob/4.2/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php

Symfony 4.3 and 4.4

public function collect(Request $request, Response $response/*, \Throwable $exception = null*/);

https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php

Symfony 5.0

public function collect(Request $request, Response $response, \Throwable $exception = null);

https://github.com/symfony/symfony/blob/5.0/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php

alcaeus commented 4 years ago

See https://github.com/doctrine/DoctrineMongoDBBundle/pull/604 - 4.1.0 with a fix will be out shortly.