sonata-admin

Roles in Sonata Admin

风流意气都作罢 提交于 2019-12-11 04:28:17
问题 Good day. I can not understand how in sonata admin bundle to add roles to users. Namely, it is necessary that the user with a specific role seen in adminpanel only one entity and only worked with her. For now, there is only one role - it ROLE_SONATA_ADMIN, which gives access to the whole adminpanel. On official site found just such an example : security: ... role_hierarchy: # for convenience, I decided to gather Sonata roles here ROLE_SONATA_FOO_READER: - ROLE_SONATA_ADMIN_DEMO_FOO_LIST -

Add a query/filter to sonata_type_collection

安稳与你 提交于 2019-12-11 03:13:25
问题 I have an entity "Product" which has a OTM relation with "ProductVariant". I would like to be able to generate a sonata_type_collection wherein only the ProductVariants with "isMaster = false" are shown. I can't use the query_builder in the sonata_type_collection. Is there another way of manipulating the generated list and still be able to insert new ProductVariants into the Product entity? My entities: /** * Product * * @ORM\Table(name="product") * @Gedmo\SoftDeleteable(fieldName="deletedAt"

SonataMediaBundle: The file “” does not exist 500 Internal Server Error - FileNotFoundException

。_饼干妹妹 提交于 2019-12-11 03:08:13
问题 I uploaded some files using the SonataMediaBundle but when i wanted to add another, i got that error. Have you any idea ? this is the stack error: in /var/www/znata.com/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php at line 107 -+ public function guess($path) { if (!is_file($path)) { throw new FileNotFoundException($path); } if (!is_readable($path)) { Thanks 回答1: Probably caused because your php.ini settings has a max uploaded size set. Change

How to define/pass the entity manager for sonata-admin

萝らか妹 提交于 2019-12-11 01:39:21
问题 I followed this tutorial to install SonataAdmin with FOSUserBundle. Now i keep getting this Error Message: No entity manager defined for class Application\Sonata\UserBundle\Entity\User But how do i set/pass the EntityManager? I haven't found anything about configuring it or any hint on what this error means. Any help anyone? Edit #1: As asked for, here is what i have in my config.yml for sonata so far: sonata_block: default_contexts: [cms] blocks: sonata.admin.block.admin_list: contexts:

SonataAdmin - sonata_type_choice_field_mask

亡梦爱人 提交于 2019-12-11 01:15:22
问题 hi all, ->add('billManagement', 'sonata_type_choice_field_mask', array( 'choices' => array( 'FI' => 'FI', 'GI' => 'GI' ), 'map' => array( 'FI' => array('company'), 'GI' => array('company') ), 'empty_value' => 'Mode de financement', 'required' => true )) ->add('company') ->end() I show here a list box with choices such as "GI" or "FI". Depending on the choice, another box list is displayed. A box Companies list. But always depending on the choice, the list of companies to be filtered. I would

Hide download button in sonata admin

我只是一个虾纸丫 提交于 2019-12-11 00:13:59
问题 I would like to hide "Download" button on Sonata Admin from some of custom entity. How to hide/delete it? If i override base_list.html.twig and remove the download button from table_footer, it disappears all of entity lists. Is there any way to hide it from Admin class? 回答1: You can hide the "download" button by removing the corresponding route: class YourClass extends AbstractAdmin { public function configureRoutes(RouteCollection $collection) { $collection->remove('export'); } } 回答2:

SonataAdminBundle can not update the user password

一个人想着一个人 提交于 2019-12-10 17:19:04
问题 I can not update the user password via sonataadmin dashboard. I use symfony2 FosUserBundle2.0 SonataAdminBundle(but not use SonataUserBundle) and follow the Document to do. MyUserBundle\Admin\UserAdmin.php class UserAdmin extends Admin like this protected function configureFormFields(FormMapper $formMapper) { $formMapper ...... ->add('plainPassword', 'repeated', array( 'type' => 'password', 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'form

Sonata Admin: send email after validation

倾然丶 夕夏残阳落幕 提交于 2019-12-10 17:13:36
问题 I am working with symfony2, sonata admin-bundle and mongodb, i just made an interface to add users, how can i send an email when user press create on sonataadmin's web interface, i have to override any class of Sonata-Admin? UPDATE //~/UserAdmin.php public function create($object) { parent::create($object); // send welcome email to new user $message = \Swift_Message::newInstance() ->setSubject('LOL') ->setFrom('no-reply@dummy.com') ->setTo('dummy@dummy.com') ->setBody('dummy message') ; $this

Can I use prePersist/preUpdate in Sonata Admin controller to persist more than one object?

折月煮酒 提交于 2019-12-10 15:48:27
问题 I have this Alias entity: use Gedmo\Timestampable\Traits\TimestampableEntity; class Alias { use IdentifierAutogeneratedTrait; use TimestampableEntity; use ActiveTrait; /** * @var string * @ORM\Column(type="string", length=150) */ private $name; /** * Command associated to the alias. * * @var Command[] * @ORM\ManyToMany(targetEntity="Command", mappedBy="aliases", cascade={"persist"}) */ private $commands; ... } And I have this Admin controller: class AliasAdmin extends Admin { protected

Batch multi step and/or form multi step in sonata admin bundle

最后都变了- 提交于 2019-12-10 15:16:32
问题 I have make search but I found nothing that help me. I use sonata admin bundle and first I want to know if it's possible to make multi step form. Second, I'd like to make a new batch action (this step is ok for me), but after user chose the batch action I want a form with field that I can use in my custom batch action. I have see it's possible to add field next the batch action list but this field are visible for all batch action for me I would like the user first chose the batch action and