sonata-admin

How to install SonataDoctrineMongoDBAdminBundle properly?

走远了吗. 提交于 2019-12-03 03:40:42
I am really getting nervous because of lacking of enough resource for installing SonataDoctrineMongoDBAdminBundle and it's dependencies like sonataUserBundle. I have been trying to install this bundle for 15 days. I did everyting agaian and again what telling in sonata's official page. But it does not work properly. After extending sonataUserBundle as ApplicationUserBundle my final documents are: User.php <?php /** * This file is part of the <name> project. * * (c) <yourname> <youremail> * * For the full copyright and license information, please view the LICENSE * file that was distributed

Symfony2 Sonata Admin show attribute only as a readyonly text

扶醉桌前 提交于 2019-12-03 02:44:23
I have some immutable attributes on my entity to administrate with sonata-admin bundle. I want to show them in the edit-view of the entity, but don't want to provide any mechanism to change it (e.g. the value shall not be inside a input field) I couldn't find anything but this: $formMapper ->add('post', 'entity', array( 'label' => 'Some post', 'attr' => array( 'readonly' => true, 'disabled' => true ), 'class' => 'Acme\DemoBundle\Entity\Post' ) ) ; I tried it out with read_only , readonly , disabled etc. all the stuff. It looks ok, it's now inside a dropdown (since it is an entity) and I can

SonataAdminBundle form field query

笑着哭i 提交于 2019-12-03 00:40:44
In SonataAdminBundle in Admin class I cannot make an orderBy on ManyToMany field . For example Author and Book. Author can have many books, as well as Book can have many Autors. In link above it is written that I can use a query for a form field. So I could prepare a query that would select authors and irder them by name. How to manage this? How to get EntityManager there in order to create query and pass it through query option? protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('name','text') ->add('author', 'sonata_type_model', array('query' => ....), array(

Soanta Admin Bundle Locale

核能气质少年 提交于 2019-12-02 19:13:05
问题 I have a problem with translation. I use symfony 2.7 sonata admin-bundle 2.3 I have create the interactive login listener, when the user log in the application I get the user locale and set the session _locale, but this is ignore in sonata. Listener is class UserLocaleListener { /** * @var Session */ private $container; public function __construct(Session $session) { $this->session = $session; } public function onInteractiveLogin(InteractiveLoginEvent $event) { $request = $event->getRequest()

Sonata Admin Bundle - Form type: sonata_type_collection - custom template?

牧云@^-^@ 提交于 2019-12-02 18:53:46
Is it possible to override the template for the form type: "sonata_type_collection"? Ive tried along these lines: $formMapper->add('slides', 'sonata_type_collection', array(), array( 'edit' => 'inline', 'inline' => 'table', 'sortable' => 'priority', 'template' => 'MyBundle:Form:slides.admin.html.twig' )); but to no avail. I know I could override the entire template, but I only want to do it for this form, not all the places where I use this form type. Does anyone know if this is possible? Thanks I found a great bit of code in /vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Form

Soanta Admin Bundle Locale

人走茶凉 提交于 2019-12-02 10:29:15
I have a problem with translation. I use symfony 2.7 sonata admin-bundle 2.3 I have create the interactive login listener, when the user log in the application I get the user locale and set the session _locale, but this is ignore in sonata. Listener is class UserLocaleListener { /** * @var Session */ private $container; public function __construct(Session $session) { $this->session = $session; } public function onInteractiveLogin(InteractiveLoginEvent $event) { $request = $event->getRequest(); $user = $event->getAuthenticationToken()->getUser(); if (null !== $user->getLocale()) { $this-

Using Sonata Admin to work with Doctrine json_array fields

落花浮王杯 提交于 2019-12-02 04:39:11
Is there any 'built in' way to administer Doctrine json_array fields using Sonata Admin? I can't find any useful documentation (or relevant code) in the Symfony / Sonata docs (or code), but I'm hoping that I missed something! Ideally I would like to see the serialised key/value pairs with a way to delete any of them and add some new ones, but I guess I'm going to have to write that up myself... You work with json_array just like with any array so You can go with collection type or sonata type collection . I like that sonata type takes care about add/delete JavaScript for You. In my entity I

Symfony2 - override template bundle

核能气质少年 提交于 2019-12-01 23:29:19
问题 I want to override the default SonataAdmin Template. I create a standard_layout.html.twig in my Namespace/bundle/resources/views (same structur, same file name, same content) I copied all the content of the source template in my target template, i just edit some part of the target off course....and nothing thanks for your help Bye 回答1: You have the solution of bundle heritance http://symfony.com/doc/current/cookbook/bundles/inheritance.html which allows, not only override templates but

Symfony2 - override template bundle

北城以北 提交于 2019-12-01 20:32:37
I want to override the default SonataAdmin Template. I create a standard_layout.html.twig in my Namespace/bundle/resources/views (same structur, same file name, same content) I copied all the content of the source template in my target template, i just edit some part of the target off course....and nothing thanks for your help Bye You have the solution of bundle heritance http://symfony.com/doc/current/cookbook/bundles/inheritance.html which allows, not only override templates but methods too. Or you have http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates which

toString method for SonataAdminBundle Listing in Symfony2

删除回忆录丶 提交于 2019-12-01 20:07:58
In Symfony 2.3 i am using SonataAdminBundle ( master ) and i am trying to get ManyToMany working in Listing. The Problem is that SonataAdminBundle is asking for a toString() method. Implementing this method to the related Entity solves the problem. My Question: Do i have to implement the toString method or is there a Option to tell SonataAdminBundle a property for using instead of calling the toString method? Thank you As far as I know, it's mandatory. But you can return another property value if you want. Also, you can prevent yourself from trying to display a property when the object has no