Closed mirlo06 closed 4 years ago
Can you have a look at this @wbloszyk
@mirlo06 Can you run composer show --latest 'sonata-project/*'
and copy it here? You do not use bug template. Some information from there are important.
BTW are you register CoreBundle?
@wbloszyk yes its registered as 'Sonata\CoreBundle\SonataCoreBundle' Result of composer show :
sonata-project/admin-bundle 3.68.0 3.68.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.19.0 3.19.0 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 2.0.1 Cache library
sonata-project/cache-bundle 3.2.1 3.2.1 This bundle provides caching services
sonata-project/core-bundle 3.20.0 3.20.0 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle 2.5.0 3.2.0 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.6.0 1.6.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.18.0 3.18.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 2.2.0 2.2.0 Lightweight Exporter library
sonata-project/form-extensions 0.1.1 1.4.0 Symfony form extensions
sonata-project/formatter-bundle 4.1.3 4.1.3 Symfony SonataFormatterBundle
sonata-project/google-authenticator 2.2.0 2.2.0 Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle 2.7.0 2.7.0 Symfony SonataIntlBundle
sonata-project/media-bundle 3.24.0 3.24.0 Symfony SonataMediaBundle
sonata-project/seo-bundle 2.10.0 2.10.0 Symfony SonataSeoBundle
sonata-project/timeline-bundle 3.5.0 3.5.0 Integrates SpyTimelineBundle into Sonata
sonata-project/twig-extensions 0.1.1 1.3.0 Sonata twig extensions
sonata-project/user-bundle 4.5.3 4.5.3 Symfony SonataUserBundle
I will reproduce it and check. I need 2-3 hours for this.
For information i could create media from command using MediaManager service :
$i_file = "path";
$media = new \App\Application\Sonata\MediaBundle\Entity\Media();
$media->setName("image");
$media->setEnabled(true);
$media->setContext('default');
$media->setProviderStatus(1);
$media->setProviderName('sonata.media.provider.image');
$media_sizes = getimagesize($i_file);
$media->setWidth($media_sizes[0]);
$media->setHeight($media_sizes[1]);
$media->setBinaryContent($i_file);
$this->mediaManager->save($media);
It is look like alias in CoreBundle is missing.
@core23 @sonata-project/contributors
I move class_alias
from CoreBundle to form-extensions and all work correct. I add die();
in CoreBundle files and it is not work. Files form CoreBundle are not loaded. Any idea why?
I did not use class_alias
es quite often. Maybe @greg0ire could help?
I mean CoreBundle are not load.
What do you mean? The 100% of the classes are not loaded or just a few? Because I have tried and some parts are loaded, example the SonataCoreBundle class and its dependencies. (not tested the whole bundle)
It mean that alias do not work becouse file is not loaded (not used). When I add:
class_exists(\Sonata\CoreBundle\Validator\ErrorElement::class);
In Sonata\Form\Validator\ErrorElement
then all works correct.
What about adding class exists for all classes on the SonataCoreBundle.php?
This will run @trigger_error
too. This mean if we use alias (Sonata\CoreBundle) we must create object by alias (or make class_exist). After make CoreBundle optional (change API to orginal name) we will be able to use object by alias or orginal namespace.
When user will be use alias then got trigger_error.
For now this will fix this issue: https://github.com/sonata-project/form-extensions/pull/100
form-extension 0.1.2 is released.
@mirlo06 can you confirm the problem is fixed ?
I reproduce this issue. Now is working.
composer update and issue fixed. Thanks a lot.
@mirlo06 Thanks for report this issue. I glad i could help.
I am not using any custom class. im using Application Sonata Media Bundle with Sonata Admin Bundle. When I am uploading image then I got error :
Argument 1 passed to Sonata\MediaBundle\Provider\Pool::validate() must be an instance of Sonata\CoreBundle\Validator\ErrorElement, instance of Sonata\Form\Validator\ErrorElement given, called in vendor/sonata-project/form-extensions/src/Validator/InlineValidator.php on line 58
This is my composer.json with php7.2