Menu
  • HOME
  • TAGS

Sonata Admin sonata_type_collection

symfony2,sonata-admin,symfony-sonata

I think that you missed something in the addAlbumHasMusiques() function in your album entity : make sure that you wrote it like that : public function addAlbumHasMusiques(\AppBundle\Entity\AlbumHasMusiques $albumHasMusiques) { $albumHasMusiques->setAlbum($this); // The important line !!!! $this->albumHasMusiques[] = $albumHasMusiques; return $this; } ...

Sonata_type_boolean bugs

php,mongodb,symfony2,sonata-admin

You could try to use a choice type : ->add('istrue', 'choice', array( 'choices' => array( 0 => 'False', 1 => 'Yes' ) )) Documentation : https://sonata-project.org/bundles/admin/master/doc/reference/field_types.html#choice A bit weird to display Yes / False instead of Yes / No or True / False :)...

sonata media bundle error

symfony2,twig,sonata-admin,sonata-media-bundle

The problem is on the sonata media bundle use "2.2.8" not "dev-master" on your composer.json and run php composer.phar update

What is the best way to display my entities at Back-office home page with the Sonata Admin Bundle

symfony2,doctrine2,sonata-admin

Well, I guess you have a service defined in your services.yml. In that service you need to grab the information you want.. So you'll need some doctrine class, but your service doesn't have these.. You can inject them in your services.yml, for example: sonata.block.service.statistics: class: Evince\ObjectsBundle\Block\Service\StatisticsService tags: - { name:...

Upgrading to Symfony 2.6 causes issue with ApplicationSonataUserExtension

php,symfony2,sonata-admin,sonata-user-bundle

Unlike Symfony 2.5, 2.6 actually has __construct() method in Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration, and its argument represents debug mode, according to this. So, adding bool variable to Configuration should solve the problem. $configuration = new Configuration(TRUE); //or FALSE, if it's in prod To get debug mode easily enough automatically, you could use something...

How to configure m2m relationship in Sonata Admin?

symfony2,sonata-admin

From the docs: This is the field type for each item in this collection (e.g. text, choice, etc). For example, if you have an array of email addresses, you'd use the email type. If you want to embed a collection of some other form, create a new instance of your...

SonataBlock, SonataAdmin and Other Sonata bundles keep showing “Validation” error

php,symfony2,sonata-admin,sonata-user-bundle

Yesterday I've experienced same problem, supposed to be related with yesterday morning updates, today I've changed my composer.json and this is my working configuration: "sonata-project/core-bundle": "2.3.*@dev", "sonata-project/admin-bundle": "2.4.*@dev", "sonata-project/user-bundle": "2.3.*@dev", "sonata-project/doctrine-mongodb-admin-bundle": "2.3.*@dev", "sonata-project/easy-extends-bundle": "2.1.*@dev", "sonata-project/block-bundle": "2.3.*@dev", "sonata-project/doctrine-orm-admin-bundle": "2.3.*@dev",...

How to set default configuration for Sonata sonata_type_date_picker

symfony2,configuration,sonata-admin

One way you can achieve to set defaults for sonata's sonata_type_datetime_picker for application wide is to override the form type service for sonata_type_datetime_picker and in class parameter define your own class to handle defaults. 1) Create a service file in your bundle form_types.xml and override sonata's service like <?xml version="1.0"...

How to reuse sonata Admin paginator with a custom crud controller

symfony2,sonata-admin

The DatagridBundle is a work in progress in order to decouple the list, pagination and filtering mechanisms from the Admin for them to be reusable elsewhere. Hence it is not stable yet. I strongly recommend you use the pagination from the AdminBundle at the moment. Regarding your main question, if...

How to separate folders using IvoryCKEditorBundle for file uploads?

php,symfony2,ckeditor,sonata-admin,sonata

This error is due to a change in the way MediaBundle works. In order to get it solved you have to go to the browser.html.twig and replace lines 46 to 58 by this: {% if (persistent_parameters.provider is defined) and ( not persistent_parameters.provider) %} <li class="active"><a href="{{ admin.generateUrl('browser', {'context': persistent_parameters.context, 'provider':...

Simple date with Sonata Admin Bundle

postgresql,symfony2,date,doctrine2,sonata-admin

I fixed the problem by modifying vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php: /** * {@inheritdoc} */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { return ($value !== null) ? // Line 53 is_object($value)?$value->format($platform->getDateFormatString()) :date($platform->getDateFormatString(), strtotime($value)) : null; } To avoid the error, that seem more like a bug. I will see for a better solution but for...

sonata media change position in gallery

symfony2,sonata-admin,symfony-sonata,sonata-media-bundle

Have you tried to drag the lines to the positions you want? If you can't drag the lines, maybe there's a problem with your javascript. Check in Firebug console if there's any error. Hope it helps!...

Use sonata_type_collection inside custom type

symfony2,sonata-admin

I find solution. Instead using my custom type, I defined form using admin class. I need this form outside admin so it was little difficult. First of all in my controller i get admin class from service. Inside admin class I override 3 methods which are use to create form...

Symfony / Sonata Admin: List form on Edit form

php,symfony2,sonata-admin,symfony-sonata,sonata

The fastest way to do what you are looking for is overriding the edit template. At your admin serivce declaration you can do so: services: sonata.admin.mail: class: %sonata.admin.category.class% tags: - { name: sonata.admin, manager_type: orm, group: "Categories", label: "Category" } arguments: - ~ - %skooli.category.class% - ~ calls: - [...

ReflectionException with Symfony and Sonata, “Class does not exist”

php,symfony2,sonata-admin,symfony-sonata

Well, the reason for this error was a bad copy/paste from the tutorial. In the Admin Class, the function configureFormFields contained a field "Description" badly described. ->with('Description') ->add('description', 'sonata_type_model', array('multiple' => false)) ->end() I had to replace it to: ->with('Description') ->add('description') ->end() I discovered that automatic Admin Class skeleton generation...

forcing auto-increment id in sonata admin custom clone action

mysql,symfony2,doctrine2,sonata-admin,symfony-sonata

I think the easy solution is to set your id to null and doctrine will generate an id for you while creating the cloned object... $clonedObject = clone $object; $clonedObject->setId(NULL); $clonedObject->setName($object->getName()." (Clone)"); ...

Symfony2 - Sonata Datagrid filter operators translation fails for doctrine_orm_class field

php,symfony2,datagrid,sonata-admin,sonata

As I upgraded the packages the missing translations occured. I upgraded to SonataAdminBundle 2.3.3, but I'm not so sure about this was the solution. Nevertheless I'm not able to repeate this problem.

List Images in sonata admin bundle

php,symfony2,sonata-admin

I suppose you're using Sonata Media Bundle you must use the entity and you can find needed helpers here: http://sonata-project.org/bundles/media/2-2/doc/reference/helpers.html If you need to get the full path in controller (can happen, very rarely but can happen) you have to use the media service $mm = $this->container->get('sonata.media.manager.media'); $pr = $this->container->get('sonata.media.provider.image');...

Sonata - missing user security status labels

symfony2,sonata-admin,symfony-sonata,sonata-user-bundle,sonata

It's a bug in symfony(?) bootstrap defaults configuration changed from twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" form: resources: ['bootstrap_3_layout.html.twig'] # resources: ['bootstrap_3_horizontal_layout.html.twig] to twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" form: # resources: ['bootstrap_3_layout.html.twig'] # resources: ['bootstrap_3_horizontal_layout.html.twig] ...

Sonata + FOSUserBundle edit roles on edit form

symfony2,fosuserbundle,sonata-admin

FOSUserBundle supports having multiple ROLES per user which is fine thing indeed. In my experience however, a common use case is a single role per user. An easy way to manage this is to add the following method to your model/entity object to obtain a single role: public function getRole()...

Symfony2 - SonataUserBundle - user profile dashboard

php,symfony2,sonata-admin,symfony-sonata,sonata-user-bundle

I have the same issue. I followed the instructions for installation, while no one says how to connect the built-in styles. The fact that it takes MopaBootstrapBundle. When you set up, you should have noticed the error that it is not installed. Use the generated ApplicationSonataUserBundle for adding a stylesheets....

Sonata Admin - how to set the menu.label attribute?

symfony2,sonata-admin,symfony-sonata

Finally found a good (and somewhat obvious) solution to this. The Sonata Admin class uses an internal toString($object) method in order to get a label string for the entity it is handling. Thus, the key is to implement the __toString() method of the entity in question: public function __toString() {...

How to remove fields from the admin user create page of Sonata User Bundle?

symfony2,sonata-admin,sonata-user-bundle,symfony-2.6

Under configuration for sonata user bundle in config.yml i.e sonata_user you can override sonata user admin class and define your own admin class sonata_user admin: # Admin Classes user: class: Application\Sonata\UserBundle\Admin\UserAdmin #Sonata\UserBundle\Admin\Entity\UserAdmin controller: ApplicationSonataUserBundle:UserCURD /** you can also override CURD controller for your admin class*/ translation: SonataUserBundle Now create your...

Access to PHPCR DocumentManager within Sonata Admin

symfony2,sonata-admin,symfony-cmf,doctrine-phpcr

Your admins are services and they have a constructor, so you are free to add your own things to the constructor and inject. In the case of the document manager, you should however use what is already provided - this is the most clear as then you know you get...

Knp\DoctrineBehaviors + a2lix_translations + Sonata Admin

symfony2,doctrine2,sonata-admin,a2lix-translation

Remove setters and getters from main class then doctrine:schema:update. Also in sonata category admin: $formMapper->add('translations', 'a2lix_translations'); ...

Only display some data Sonata

php,symfony2,sonata-admin

To filter listing you have to use createQuery in your admin class, for exemple : public function createQuery($context = 'list') { $user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser(); $query = parent::createQuery($context); $query->andWhere($query->getRootAlias() .'.user =: user')); $query->setParameter('user', $user); return $query; } To display more fields depending in user roles you can do that in the...

Sonata Admin v2.3 - Order by on multiple columns with sortable = false

symfony2,doctrine2,sql-order-by,sonata-admin

This is due to the following addition in the new version; the orderBy options are removed if ProxyQuery::getSortOrder() doesn't return anything. In this case the method is automatically called by the Datagrid::buildPager() IF AND ONLY IF the list configuration has at least one column set to 'sortable' => true, see...

Sonata Project: an admin service for multiple entities

php,symfony2,doctrine2,sonata-admin

You will need to use some advanced features from Sonata Admin. To read about them, please go to: http://sonata-project.org/bundles/admin/2-1/doc/reference/advance.html, specially "16.3. INHERITED CLASSES". This way you will have Add Buttons and create/edit views for each of your subclasses.

SonataAdminBundle files uplaod to /tmp

php,symfony2,sonata-admin

Yes it's normal. I recommend you to read this part of official Symfony documentation about file upload. Your file is upload to /tmp. If you sent it directly to DB without store it in another directory, it's lost. official doc : http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html It show you how to store it......

No Entity Manager in Custom Class and ContextErrorException

symfony2,sonata-admin

You get error because add manager in wrong place. First argument of admin service should be set as the admin service’s code (defaults to the service’s name). Admin class pharse this string and build some logic based on. You put there manager so you get error. If you want to...

install sonata ecommerce ERROR

php,symfony2,sonata-admin,sonata

Try this in your composer.json : "sonata-project/ecommerce": "dev-master" If the same problem persist try this : "sonata-project/ecommerce": "2.3.*@dev" ...

Updating symfony2 composer raise errors

symfony2,composer-php,sonata-admin

You're using an outdated version of Symfony2: 2.2. The dev-master branch of sonata-project/admin-bundle requires the ~2.3 version of sensio/generator-bundle which is not available with Symfony 2.2. You should try the 2.2.x-dev version which requires the 2.2 version of sensio/generator-bundle. So you have to edit your composer.json file and replace: "sonata-project/admin-bundle":...

SONATA USER BUNDLE/FOS USER BUNDLE

symfony2,fosuserbundle,sonata-admin,sonata-user-bundle

I found the solution here: https://github.com/sonata-project/SonataUserBundle/issues/412 in app/Resources/FOSUserBundle/views/Registration/register.html.twig With the same content as in the original one, without extending any layout: {% block fos_user_content %}<br> {% include "FOSUserBundle:Registration:register_content.html.twig" %}<br> {% endblock fos_user_content %} ...

Custom entity in symfony 2

php,symfony2,sonata-admin

You should change your function declaration to: public function getStatus(\Map\Bundle\StudentBundle\Entity\Student\Preference $preference) By adding the = null at the end of your parameter, you are making Preference an optional argument. If you don't pass anything in, the value of $preference will be null. So at that point you don't have a...

SonataAdmin $formMapper->add() entity filtering

symfony2,doctrine,sonata-admin

class WorkerAdmin extends Admin { protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('fname', 'text', array('label' => 'First Name')) ->add('lname', 'text', array('label' => 'Last Name')) ->add('User', null, array( 'class' => 'Application\Sonata\UserBundle\Entity\User', 'query_builder' => function($repository) { return $repository->createQueryBuilder('u') ->leftJoin('u.worker', 'w') ->where('w is null'); })); } } ...

SonatajQueryBundle no longer installed as dependency

symfony2,sonata-admin

Assets management has been improved in the upcoming stable version. The SonataAdminBundle now uses bower to handle assets (https://github.com/sonata-project/SonataAdminBundle/issues/2036). So if you update your code, you will need to remove SonatajQueryBundle. Also, there is a new configuration section to add your assets in the AdminBundle. So you can have a...

SonataAdminBundle can not update the user password

symfony2,fosuserbundle,sonata-admin,change-password

that's because you have to catch the object User (preUpdate() and prePersist()) and set password using $user->setPlainPassword. Thats how my code looks: Instead: ->add('plainPassword', 'repeated', array( 'type' => 'password', 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'form.password'), 'second_options' => array('label' => 'form.password_confirmation'), 'invalid_message' => 'fos_user.password.mismatch', 'required' => false,...

“The block type sonata.Admin.block.admin_list does not exist”

php,symfony2,twig,sonata-admin

You have to specify all blocks in app/config/config.yml like in this answer sonata_block: default_contexts: [cms] blocks: sonata.user.block.menu: sonata.user.block.account: sonata.block.service.text: sonata.admin.block.admin_list: contexts: [admin] ...

Set a field like choose in sonata Admin bundle

symfony2,sonata-admin,symfony-sonata

Instead of choice, you need to use "sonata_type_model" http://sonata-project.org/bundles/admin/master/doc/reference/form_types.html#sonata-type-model In this case you code will become: protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('nombre') ->add('facultad','sonata_type_model') ; } ...

Sonata Admin translation does not translate translation array

php,symfony2,sonata-admin,symfony-sonata,sonata

I suposse that somewhere in your project there is translation for admin.form.label. When you define the same key as value and also as array, only one of translation work. Eg: admin: translation for admin admin: form: translation for admin.form ...

How to embed child entities in sonata admin show views?

php,symfony2,doctrine,sonata-admin

Since you have a property in your parent entity which refers to your child entity you can call child fields in your configureShowFields methods to show fields from your child entity protected function configureShowFields(ShowMapper $showMapper) { $showMapper ->with('Child Fields', array('collapsed' => true)) ->add('child.propertyName',null,array('label'=>'Label')) ->add('child.anotherPropertyName',null,array('label'=>'Label')) ... ; } ...

Project Architecture

symfony2,doctrine2,sonata-admin

If you just use same classes in both bundles, you should use this architecture inspired from the symfony architecture src | myvendorname |Bundles | FrontOfficeBundle | BackOfficeBundle |Components | MyMutualClasses1 | MyMutualClasses2 Or if you use the SAME services in both bundles, declare the services in your MutualBundle ( Be...

Override a translation on the Sonata Admin login screen

php,symfony2,php-5.3,sonata-admin,sonata

Overriding translations is not specific to Sonata, but to Symfony. See the "Overriding any part of a bundle" section of the symfony doc : http://symfony.com/doc/current/cookbook/bundles/override.html#translations...

Sonata Admin - Disable list view

symfony2,sonata-admin

If you want to do a custom query for your list view, you could override the createQuery method in your Admin class like this : class EntityAdmin { public function createQuery($context = 'list') { $query = parent::createQuery($context); $query->andWhere( $query->expr()->eq($query->getRootAlias() . '.id', ':id') ); $query->setParameter('id', 1); return $query; } } You...

Error generating custom url that shows a phpcr document version in SonataAdmin

symfony2,sonata-admin,symfony-cmf,doctrine-phpcr

Bit of digging around and the answer was simple, just had to override the pattern for id to be .+ protected function configureRoutes(RouteCollection $collection) { $collection->add('show_version', $this->getRouterIdParameter() . '/show/{version}', array(), array('id' => '.+')); } ...

default Filtering Sonata admin list without a Filter filed

php,mongodb,symfony2,sonata-admin

You can override createQuery function of Admin class as described here, https://sonata-project.org/bundles/admin/master/doc/reference/action_list.html#customizing-the-query-used-to-generate-the-list public function createQuery($context = 'list') { $query = parent::createQuery($context); $query->field('tenant_id')->equals("YOUR USER ID"); return $query; } ...

Sonata Admin Bundle configureRoutes getPersistentParameters

parameters,routes,sonata-admin

You can set an admin to be the child of another. This has the advantage that you can, for example, click from one specific client to a list of loans for that particular clients.. To do this, follow the minimalistic documentation on the subject on setting an admin as child-admin:...

Sonata admin enhanced view for security roles

symfony2,sonata-admin,symfony-sonata,sonata-user-bundle,sonata

Adding my own answer In Sonata admin if you wish to change display security roles as a user friendly view you have to override below sonata's services sonata.user.editable_role_builder sonata.user.form.type.security_roles And definitions will look like as below <services> <service id="sonata.user.editable_role_builder" class="Acme\DemoBundle\Security\EditableRolesBuilder"> <argument type="service" id="security.context" /> <argument type="service" id="sonata.admin.pool" />...

SonataAdminbBundle access issue after logout

php,security,symfony2,authentication,sonata-admin

Configure security.yml: security: encoders: FOS\UserBundle\Model\UserInterface: sha512 role_hierarchy: ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN] ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] SONATA: - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT # if you are using acl then this line must be commented providers: fos_userbundle: id: fos_user.user_manager firewalls: # Disabling the security for the web debug toolbar, the profiler and Assetic. dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security:...

SF2 and sonata admin, cannot see my Admin

php,symfony2,sonata-admin

I replace: handler: sonata.admin.security.handler.role by handler: sonata.admin.security.handler.noop ...

Check if date already exists in another time period

php,symfony2,doctrine,sonata-admin,sonata

I don't know how Sonata works with forms, but I think you should use validation constraint instead of listener.. Here is a usual form example: private $em; public function __construct(EntityManagerInterface $em) { $this->em = $em; } public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver ->setDefaults(array( ... 'constraints' => array( new Callback( array('callback'...

How to override templates per Entity in SonataAdminBundle

symfony2,sonata-admin

Form the documentation: If you wish, you can specify custom templates on a per Admin mapping basis. Internally, the CRUDController fetches this information from the Admin class instance, so you can specify the templates to use in the Admin service definition: XML: <service id="sonata.admin.post" class="Acme\DemoBundle\Admin\PostAdmin"> <tag name="sonata.admin" manager_type="orm" group="Content" label="Post"/>...

Using a custom view page for image preview in Sonata Admin in Symfony 2 project

php,symfony2,php-5.3,sonata-admin,sonata

If you want to display a blank page with an image (within the Sonata Admin layout): // src/ACME/YourBundle/Resources/views/empty_layout.html.twig {% extends "SonataAdminBundle::standard_layout.html.twig" %} {% block sonata_page_content %} <img src="{{ image.src }}" /> {% endblock %} And in your controller: return $this->render('ACMEYourBundle::empty_layout.html.twig', array('image' => $object)); If you just want a blank page...

How to redirect after successful login setting default_target_path on all firewalls using FOSUserBundle and SonataAdminBundle in Symfony2 Security

symfony2,fosuserbundle,sonata-admin,symfony-security

Try this configuration : admin: pattern: /qis(.*) form_login: provider: fos_userbundle login_path: sonata_user_admin_security_login use_forward: true use_referer: true check_path: sonata_user_admin_security_check failure_path: null logout: path: sonata_user_admin_security_logout anonymous: true You need to set anonymous to true to allows user to authenficate. The login page must have a public access....

Symfony route being lost when importing multiple yaml files

php,ruby-on-rails,symfony2,sonata-admin,symfony-sonata

I have found that this was caused by not having a correctly named service in admin.yml for both bundles. When I was getting the error I had sonata.admin.post set for both "Contact" and "Link" entities, but after renaming them as follows my second entry under imports worked a treat. Contact...

Sonata, Sf2 : Attempted to call method “ifTrue” on route /classification/context/create

php,symfony2,sonata-admin,sonata

The method ifTrue or ifFalse are going to land in the 2.4 release of SonataAdminBundle. Please use stable version of bundles.

How to get images listed in sonata admin bundle backend

php,symfony2,doctrine2,doctrine,sonata-admin

The simplest way is to create custom admin field template. In configureListFields method add: ->add('path', null, array('template' => 'AcmeBundle:Admin:list_image.html.twig')) And create file AcmeBundle/Resources/views/Admin/list_image.html.twig with content: {% extends 'SonataAdminBundle:CRUD:base_list_field.html.twig' %} {% block field%} <div> <img src="{{ object.webPath | imagine_filter('gallery_element_admin') }}" /> {# or whatever to create src of image #} </div>...

Sonata Admin Filter: Invalid parameter number: number of bound variables does not match number of tokens

php,symfony2,doctrine2,sonata-admin,symfony-sonata

I had the same issue. Change in your query ->where(sprintf('cr_.review = %s', $alias)) for ->andWhere(sprintf('cr_.review = %s', $alias)) You get into the middle of the querie and you can not modify it....

Sonata Admin - boolean field type, label not displayed

symfony2,sonata-admin,sonata

OK I found the solution: I was using Symfony 2.6.* when I changed to Symfony 2.3 problem was fixed! So I look in SonataAdmin GitHub issue to found this working solution: https://github.com/sonata-project/SonataAdminBundle/issues/2630 At the end I am in Symfony 2.6 with checkbox label....

Nested menu items at SonataAdminBundle sidebar

php,symfony2,sonata-admin,symfony-sonata,sonata

Yes, you can. But not precisely as you specified it. SonataAdmin now integrates KnpMenu to generate the side menu. It is documented here (https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_knp_menu.html); take care to be on the master version though, this has not yet been released as a stable version. Note: As the documentation has not been...

Custom sonata-admin template for an entityAdmin formMapper

jquery,symfony2,templates,sonata-admin

You can't use extends in your custom template, extends only support single inheritance. The template form_admin_fields.html.twig of SonataAdmin already uses extends, so you must change extends by use in your twig template : {% use '::SonataAdminBundle:Form:form_admin_fields.html.twig' %} You should be able to access your form variables with {{ form.latitude }}....

Twig : Entity was not found

symfony2,twig,sonata-admin

It's a common problem when you use softdeleteable or if you have a legacy db with some integrity problems(ids without related row). In this case the proxy of entity is created fine(with its id) but when you get something else the proxy tries to fetch the real entity and fails...

Change theme(css) for SonataAdminBundle

twitter-bootstrap,symfony2,sonata-admin,symfony-2.3,symfony-sonata

You may override the standard_layout.html.twig template file to use your custom theme, as well as all layouts from the SonataAdminBundle. Those files are configurable here: sonata_admin: templates: layout: SonataAdminBundle::standard_layout.html.twig ajax: SonataAdminBundle::ajax_layout.html.twig list: SonataAdminBundle:CRUD:list.html.twig show: SonataAdminBundle:CRUD:show.html.twig edit: SonataAdminBundle:CRUD:edit.html.twig history: SonataAdminBundle:CRUD:history.html.twig preview: SonataAdminBundle:CRUD:preview.html.twig delete:...

Sonata Admin remove the batch column from list view

symfony2,sonata-admin

You can remove or add batch actions by overriding the batchActions method. You just have to add your own batchActions method in your Admin class. To remove the delete action you have to do this : class Admin { public function getBatchActions() { $actions = parent::getBatchActions(); unset($actions['delete']); return $actions; }...

Gedmo translatable / default locale and sonata admin bundle

symfony2,doctrine,sonata-admin,symfony-sonata

Ok, I solved it by adding the following options to the StoDoctrineExtensions-Bundle: stof_doctrine_extensions: translation_fallback: false persist_default_translation: true ...

The show action of Symfony 2 Sonata Admin Bundle is not working

php,symfony2,sonata-admin,symfony-2.6

You're missing a s in your function's name. it's configureShowFields(FormMapper $formMapper) not configureShowField(FormMapper $formMapper) ...

Inline editable OneToOne relation in sonata admin bundle

php,symfony2,doctrine,sonata-admin

I think you must use sonata_admin_type as field form type ... http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/form_types_and_transformers.html

Only two admin panels showing in Sonata Admin dashboard

php,symfony2,sonata-admin,symfony-sonata,sonata

I found the problem with this, it was in my GalleryBundle admin.yml (which I had copied from the CommonBundle. I had sonata.link.admin.post, so I replaced it with gallery as I imagine it was overwriting it. services: sonata.gallery.admin.post: class: AyrshireMinis\GalleryBundle\Admin\GalleryAdmin tags: - { name: sonata.admin, manager_type: orm, group: "Gallery", label: "Image"...

Create new brand from company: embed admin in admin in SonatAdminBundle

php,symfony2,sonata-admin,symfony-sonata,symfony-2.6

I didn't fully understand your request, but from what I understood : To create / select / delete company from brand class BrandAdmin extends Admin { protected function configureFormFields(FormMapper $formMapper) { $formMapper->add('company', 'sonata_type_model_list', array( 'by_reference' => false )); } } Documentation: https://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/form_field_definition.html#advanced-usage-many-to-one Add new brands in Company form class CompanyAdmin...

Can not use CRUDController

php,mongodb,symfony2,sonata-admin

You have already imported the Controller class. And so you need to rename it in the second case. Override your use-block with next: use Session\UserBundle\Document\User; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Sonata\AdminBundle\Controller\CRUDController as Controller; As you see I deleted first occurrence of Controller class that is not used in...

SonataUserBundle overriding EditableRolesBuilder

symfony2,override,sonata-admin,sonata

In Sonata admin if you wish to override security roles handler you have to override 2 services sonata.user.editable_role_builder sonata.user.form.type.security_roles And definitions will look like as below <services> <service id="sonata.user.editable_role_builder" class="Acme\DemoBundle\Security\EditableRolesBuilder"> <argument type="service" id="security.context" /> <argument type="service" id="sonata.admin.pool" /> <argument>%security.role_hierarchy.roles%</argument> </service> <service...

DOCTRINE 2 Use two entities for one object

symfony2,doctrine2,sonata-admin

The best way to solve your problem is to use one entity for both cases. But in every case when you don't need some fields just exclude it from serialised object. If you have different fields in these entities and different purpose for them you can use single table inheritance...

Remove child admins from sidemenu in sonata-admin

php,symfony2,sonata-admin,symfony-sonata

Add the show_in_dashboard: false tag to the Admin services you wish to exclude from the menu. tags: - { name: sonata.admin, manager_type: orm, group: "Contenido", label: "Módulos de Tiempo",label_translator_strategy: "sonata.admin.label.strategy.underscore", show_in_dashboard: false } Keep the group and label tags so they show up correctly in collections and type admins!...

SF2: Secure route and deny access through exception instead of redirect to login

symfony2,sonata-admin,symfony-sonata

Take a look at Entry Point option in a firewal - http://symfony.com/doc/current/components/security/firewall.html#entry-points This question/answer may have the information you need - What is the best way to notify a user after an access_control rule redirects?...

Translation label for Choice field are not working in Sonata Admin Datagrid filter

php,symfony2,sonata-admin,sonata-user-bundle,symfony-2.7

I solved this by adding /app/Resources/translations/messages.en.xliff with the following content: <?xml version="1.0"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="en" datatype="plaintext" original="file.ext"> <body> <trans-unit id="filter.label_enabled"> <source>filter.label_enabled</source> <target>Enabled</target> </trans-unit> <trans-unit id="label_type_yes"> <source>label_type_yes</source>...

OneToOne relation with sonata_type_admin : field not linked to an admin

symfony2,sonata-admin

Your mapping is not correct. There should not be such line. @ORM\Column(name="image", type="string", length=255) @ORM\Column overrides @ORM\OneToOne and Doctrine sees this field as simple field - not as association. http://doctrine-orm.readthedocs.org/en/latest/reference/annotations-reference.html#annref-onetoone...

sonata admin bundle symfony

php,symfony2,fosuserbundle,sonata-admin

I'm not sure, why sonata doesn't automatically generate baseRouteName for you. I suppose that you define your custom directory structure or custom class name. You can dump return of getBaseRouteName method. This method is used to generate routing information. You can also define it (not automatically).: private $baseRouteName = 'your_name';...

How to pass a function as a parameter in admin class [duplicate]

php,mongodb,symfony2,sonata-admin

You can override getFilterParameters() method to change your $datagridValues: public function getFilterParameters() { $this->datagridValues = array_merge(array( 'email' => array ('type1' => 2, 'value' => function()), ), $this->datagridValues); return parent::getFilterParameters(); } ...