symfony-sonata

moving bundle from vendor to src directory

陌路散爱 提交于 2020-01-16 12:19:28
问题 I installed SonataMedia in the vendor/ directory of my project using composer and everything was working fine. I wanted to move the bundle to the src folder to keep everything tidy.. is there any way to move bundle from vender to src directory? 回答1: Yes, copy past the namespace directories to the src directory... But really, why do you want this? The directory structure is not important and even if it was, it is better to put the 3th party bundles in the vendor directory to seperate your

How to process each entity in SonataAdminBundle list view?

假如想象 提交于 2020-01-13 19:57:07
问题 How to apply some code to each entity being displayed in Admin's list view? For example, if I have a TagManager and need to load tags for each entity being displayed, how do I do that? Is there a method to override in entity's Admin or can I bind to some list form event? I could not find a place to do that. I don't wan't to bind to entity's onLoad event. 回答1: EDIT: In your entityAdminController : public function listAction() { if (false === $this->admin->isGranted('LIST')) { throw new

How to install SonataDoctrineMongoDBAdminBundle properly?

核能气质少年 提交于 2020-01-12 03:41:08
问题 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> * *

Symfony2 Sonata Admin show attribute only as a readyonly text

假如想象 提交于 2020-01-12 03:31:09
问题 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 ,

Sonata change default format_date

青春壹個敷衍的年華 提交于 2020-01-11 14:20:23
问题 I have installed the SonataIntlBundle bundle. The default format_date results in a format like day-number month-name year . {{ date_time_object | format_date }} => '1 août 2011' Source Now, I want to change this default to dayNumber-monthNumber-yearNumber for people with a english translation (en) and to monthNumber-dayNumber-yearNumber for people with a dutch translation (nl). How should I do this and is their any documentation? 回答1: {{ date_time_object | format_date('MM-dd-yyyy', 'nl') }}

Sonata Admin Bundle: show total count of collection on list view

落爺英雄遲暮 提交于 2020-01-11 03:49:25
问题 Is there any way to show total count of collection on list view? Imagine that there is a user that can have many links. How can I show total links count on list view? 回答1: Show field it is quite easy, there is solution for sorting by this virtual field. Entity/Some.php more about count here Extra Lazy Associations public function getCommentsCount() { return $this->getComments()->count(); } SomeAdmin.php override createQuery and configure list field public function createQuery($context = 'list

How to customize configureDatagridFilters in Sonata Admin to use non related mongodb documents

本小妞迷上赌 提交于 2020-01-06 02:41:05
问题 In my Mongodb I got a passenger document, this is a typical item: { "_id" : ObjectId("51efdf818d6b408449000002"), "createdAt" : 1374674817, "phone" : "222222", .. } I also have a device document that references a passenger document, here is an example: { "_id" : ObjectId("51efdf818d6b408449000001"), "os" : "android.gcm", "passenger" : ObjectId("51efdf818d6b408449000002"), .. } so in other words.. there is no way I can find out the device belonging to a passenger by running a query on

Sonata Media: The file could not be found

早过忘川 提交于 2020-01-05 06:50:00
问题 I'm trying to attach an image to an Entity but when I submit the form, an error is displayed saying: The file could not be found. Here is my code to build the form: $builder ->add('email', 'email', array('label' => 'Email')) ->add('name', 'text', array('label' => 'Name')) ->add('image', 'sonata_media_type', array('label' => 'Image', 'provider' => 'sonata.media.provider.image', 'context' => 'default')) ; What am I doing wrong? Thanks 回答1: First, you need to 'link' your Entity to the

Sonata Media: The file could not be found

半城伤御伤魂 提交于 2020-01-05 06:49:28
问题 I'm trying to attach an image to an Entity but when I submit the form, an error is displayed saying: The file could not be found. Here is my code to build the form: $builder ->add('email', 'email', array('label' => 'Email')) ->add('name', 'text', array('label' => 'Name')) ->add('image', 'sonata_media_type', array('label' => 'Image', 'provider' => 'sonata.media.provider.image', 'context' => 'default')) ; What am I doing wrong? Thanks 回答1: First, you need to 'link' your Entity to the

sonataNotificationBundle, emails getting stored to database but swiftmailer consumer is not triggered and no emails are sent

倖福魔咒の 提交于 2020-01-03 04:58:06
问题 I have integrated sonataNotificationBundle, i configured backend to doctrine, emails are getting stored in database notification__message table but are not getting sent. How do I send emails from database using swiftmailer consumer. Below is the configuration sonata_notification: backend: sonata.notification.backend.doctrine backends: doctrine: message_manager: sonata.notification.manager.message.default max_age: 86400 # max age in second pause: 500000 # delay in microseconds states: #