I got the following error during installing SonataNewsBundle.
Unable to register extension "Sonata\FormatterBundle\Extension\ControlFlowExtension" as it is already registered in . (which is being imported from "/home/yoesoff/Documents/projects/oblog/config/routes/sonata_admin.yaml"). Make sure there is a loader supporting the "sonata_admin" type.
And following Error
The target-entity App\Entity\SonataMediaMedia cannot be found in 'App\Entity\SonataClassificationCollection#media'.
I just followed the official documentation from here.
Anybody can help regarding it?
There's a step missing in the documentation - looks like we manually need to add an extra package that creates the missing classes:
composer require sonata-project/media-orm-pack
Note that if you are using sonata-project/classification-bundle
, you need to fix annotations for App\Entity\SonataMediaMedia::$category
like so:
/**
* ORM\ManyToOne(
* targetEntity="App\Entity\SonataClassificationCategory",
* cascade={"persist"}
* )
* ORM\JoinColumn(name="category_id", referencedColumnName="id", onDelete="SET NULL")
*
* @var SonataClassificationCategory
*/
protected $category;
If it helps, as far as I understand we should be skipping the sonata:easy-extends:generate
steps when using Symfony 4 / Flex.
The Flex recipes should be creating classes in our App\Entity
namespace.
If they do not it will be something along the lines of the above where things need added manually.