Показаны сообщения с ярлыком sonata-admin. Показать все сообщения
Показаны сообщения с ярлыком sonata-admin. Показать все сообщения

среда, 18 апреля 2018 г.

[Sonata] "A non well formed numeric value encountered" error at upload

be sure you are using appropriate context in related form type in Sonata Admin class. If you doesnt need resizing or changing image compression, try to remove formats node in config.yml sonata_media node. It should looks like similar, without formats:

banner:    providers:        - sonata.media.provider.image

четверг, 11 августа 2016 г.

Unable to find mapping information for the class Context

Need to fully configure sonata-classification-bundle, its needed for modern versions of sonata-media.

понедельник, 11 июля 2016 г.

how to fix Symfony CSRF token is invalid. Please try to resubmit the form

If you have problems with uploading files, you should not disable  CSRF, only fix it with this hints:

* make sure in php.ini (in all directories in /etc/php5/) max_post_size much bigger than upload_size.
* do not forget to restart server (apache or nginx) and "service php5-fpm restart"

среда, 6 июля 2016 г.

How to add radiobuttons field in Sonata-Admin

protected function configureFormFields(FormMapper $formMapper) {
$formMapper
->add('lang', 'choice', [    'expanded' => true,    'choices' => [    '0' => 'LV',    '1' => 'RU',    '2' => 'EN'        ]]);
}

Pool::validate() must be an instance of ..\ErrorElement, instance of ..\ErrorElement given

Just downgrade sonata-project/media-bundle to 2.3.3. In my situation it was 2.3.4.

Thanks to https://github.com/sonata-project/SonataMediaBundle/pull/963

пятница, 1 июля 2016 г.

Sonata-admin how to add entity filter

protected function configureDatagridFilters(DatagridMapper $datagridMapper){    $datagridMapper        ->add('id')        ->add('translations.name', null, ['label' => 'Name'])        ->add('eanCode')        ->add('catalogCode')        ->add(            'product', null, [], 'entity', [            'class'    => 'AppBundle\Entity\Product',            'property' => 'name'        ])    ;}

In the beginning I thought that 'entity' doesn't work in sonata-admin ^2.3, 
and tried 'doctrine_orm_choice'. It could get elements in dropdown, but filter didn't 
worked correctly (results always was empty, but there should be elements).