Ale podczas dodawania występuje taki błąd:
There is no main category related to context: product
Plik product.php:
//private $filename; /** * @var \Application\Sonata\MediaBundle\Entity\Media * @ORM\ManyToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY") */ protected $media; /** * @param MediaInterface $media */ public function setMedia( $media) { $this->media = $media; } /** * @return MediaInterface */ public function getMedia() { return $this->media; }
plik productAdmin:
'provider' => 'sonata.media.provider.image', 'context' => 'product' ))
plik config.yml:
sonata_media: # if you don't use default namespace configuration #class: # media: MyVendor\MediaBundle\Entity\Media # gallery: MyVendor\MediaBundle\Entity\Gallery # gallery_has_media: MyVendor\MediaBundle\Entity\GalleryHasMedia db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr it is mandatory to choose one here default_context: default # you need to set a context contexts: default: # the default context is mandatory providers: - sonata.media.provider.image formats: small: { width: 100 , quality: 100} big: { width: 500 , quality: 100} product: providers: - sonata.media.provider.image formats: preview: { width: 100, quality: 100} small: { width: 200, quality: 100} large: { width: 600, quality: 100} cdn: server:
Galeria dla contextu default działa dobrze, tylko problem występuje chyba tylko przy dodaniu nowego contextu.
Wyczytałem w googlach że to ma związek z sonata classification bundle, ale nie za bardzo wiem co mam tam ustawić.
może coś jeszcze trzeba ustawić, zrobiłem to welug dokumentacji.
Ktoś wie jak rozwiązać ten problem?