Closed khalil1608 closed 6 years ago
Looks like we're not fully sf 4 compatible. Feel free to fix this @khalil1608
Have you tried the latest 3.x@dev release?
The problem is that MediaManager (sonata service.media.manager.media) can't connect automatically so you have to do it manually.
First check this service in your terminal and find information about this service by typing:
php bin/console debug:container sonata.media.manager.media
Result
Service ID sonata.media.manager.media Class Sonata\MediaBundle\Entity\MediaManager
Now go to services.yaml and create an alias:
Sonata\MediaBundle\Entity\MediaManager: '@sonata.media.manager.media'
Now you can use MediaManager
use Sonata\MediaBundle\Entity\MediaManager;
...
private $mediaManager;
public function __construct(MediaManager $mediaManager)
{
$this->mediaManager = $mediaManager;
}
Hello,
I'm trying to get the sonata media manager with the symfony container in a Fixture Class
$this->container->get('sonata.media.manager.media')
I have the errorWhen I try to get it in the __construct with:
I have the error :
Any Idea ?
Thank you
Environment
Ubuntu 16.04 Docker With Debian 8 Php 7.1.3-fpm
Sonata packages
Symfony packages
PHP version