sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
451 stars 495 forks source link

Catchable Fatal Error: Argument 1 passed to Sonata\MediaBundle\Provider\Pool::validate() must be an instance of Sonata\AdminBundle\Validator\ErrorElement, instance of Sonata\CoreBundle\Validator\ErrorElement given #1290

Closed KunwarSiddharthSingh closed 7 years ago

KunwarSiddharthSingh commented 7 years ago

This is my composer.json

"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "3.x",
"sonata-project/doctrine-orm-admin-bundle": "^2.3",
"gedmo/doctrine-extensions": "^2.4",
"sonata-project/user-bundle": "^2.2",
"friendsofsymfony/user-bundle": "^1.3",
"sonata-project/easy-extends-bundle": "^2.1",
"knplabs/knp-menu": "~1.1",
"knplabs/knp-menu-bundle": "~1.1",
"sonata-project/media-bundle": "^3.6",
"sonata-project/intl-bundle": "^2.2",
"jms/serializer-bundle": "~0.13",
"stof/doctrine-extensions-bundle": "^1.2",
"ob/highcharts-bundle": "^1.2",
"egeloen/ckeditor-bundle": "^3.0",
"friendsofsymfony/rest-bundle": "^1.7",
"friendsofsymfony/elastica-bundle": "^3.1",
"knplabs/knp-paginator-bundle": "^2.5",
"aws/aws-sdk-php": "2.8.22",
"amazonwebservices/aws-sdk-for-php": "dev-master",
"KnpLabs/Gaufrette": "dev-master",
"knplabs/knp-gaufrette-bundle": "dev-master",
"vich/uploader-bundle": "0.14.*",

I am not using any custom class. Just Use default Sonata Media Bundle with Sonata Admin Bundle. When I am uploading image then I got error :- Catchable Fatal Error: Argument 1 passed to Sonata\MediaBundle\Provider\Pool::validate() must be an instance of Sonata\AdminBundle\Validator\ErrorElement, instance of Sonata\CoreBundle\Validator\ErrorElement given

jlamur commented 7 years ago

To be closed (@greg0ire) cf. https://github.com/sonata-project/SonataMediaBundle/issues/970#issuecomment-327184487

ychadwick commented 6 years ago

Actually this but is still open, the InlineValidator of the CoreBundle is used in the validations.xml file of the media bundle. The InlineValidator uses the CoreBundle\Validator\ErrorElement but the Pool class in the MediaBundle wants a AdminBundle\Validator\ErrorElement.

THIS IS NOT A COMPOSER ERROR This is an error in the MediaBundle which is not there in version 2.3.3 and was introduced in version 2.3.4.

Here you can see the Pool class needs the AdminBundle\Validator\Element screen shot 2017-12-27 at 14 09 14

Here you can see that the MediaBundle is using the CoreBundle\Validator\InlineValidator screen shot 2017-12-27 at 14 08 36

And here you can see that the CoreBundle\Validator\InlineValidator creates a new instance of ErrorElement, but it is a CoreBundle\Validator\InlineValidator screen shot 2017-12-27 at 14 08 50

OskarStark commented 6 years ago

@ychadwick please open a new issue, reference this one and fill in the issue template, which version are you using of sonata, symfony and php, thank you!