FAQ Database Discussion Community


Nested menu items at SonataAdminBundle sidebar

php,symfony2,sonata-admin,symfony-sonata,sonata
I would like to nested menu items like a tree. I have this configuration at the moment: dashboard: groups: company: icon: <i class="fa fa-lg fa-fw fa fa-cogs"></i> label: Company items: - sonata.admin.company - sonata.admin.brand - sonata.admin.media - sonata.admin.message territory: icon: <i class="fa fa-lg fa-fw fa fa-cogs"></i> label: Territory items: -...

Sonata Project: an admin service for multiple entities

php,symfony2,doctrine2,sonata-admin
I have a doctrine Inheritance and I don't know how to manage it with Sonata My parent /** * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorMap({"abstract_page" = "AbstractPage", "content_page" = "ContentPage"}) */ abstract class AbstractPage { protected $name } One of the children /** * @ORM\Table(name="content_page") */ class ContentPage extends AbstractPage...

Sonata Admin - Disable list view

symfony2,sonata-admin
I'm facing a problem with Sonata Admin. Is there a way to disable the "list view" ? I would like to fetch the first entity in the database and to go on it when clicking on the link in the sidebar. But not for all entry. Is there a clean...

How to embed child entities in sonata admin show views?

php,symfony2,doctrine,sonata-admin
I am using symfony2 with the sonata admin bundle. Now I have an entity which has OneToOne association to another entity. I want the embed the show form of the child entity into the show form of the parent entity. I have tried the form type "sonata_type_admin" but that only...

Custom sonata-admin template for an entityAdmin formMapper

jquery,symfony2,templates,sonata-admin
I have an 'map' entity with fields 'latitude' and 'longitude'. These fields are completed from this jQuery plugin adapted. While generating a Symfony2 standard CRUD works perfect (obviously modifying the default generated code) in sonata admin I can not integrate it. I have some problems with the template inheritance and...

default Filtering Sonata admin list without a Filter filed

php,mongodb,symfony2,sonata-admin
I'm using Sonata MongoDb Admin Bundle and I need to filter by default my List data without filter field. I have a 'tenant_id' attribute in my model and I want to show models only if the tenant_id equal to the id of the connected user. Any one can help ?...

Sonata Admin sonata_type_collection

symfony2,sonata-admin,symfony-sonata
I have an issue with Sonata admin form... I would like to insert music in a album with position... My issue is when I create an album... I can add many as I want AlbumHasMusic... But when I submit my form... Each AlbumHasMusic have a null album whereas music and...

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

php,symfony2,sonata-admin,symfony-sonata,symfony-2.6
I have this two tables (see pics below) mapped as follow: class Brand { ... /** * @var Company * * @ORM\ManyToOne(targetEntity="Company") * @ORM\JoinColumn(name="companies_id", referencedColumnName="id") */ protected $company; } class Company { ... } I have two admin classes: CompanyAdmin and BrandAdmin. I need to add support for add a...

Simple date with Sonata Admin Bundle

postgresql,symfony2,date,doctrine2,sonata-admin
I have a form with Sonata Admin Bundle with a date, to set the birthday of the user we want to add. Here goes MemberAdmin.php : /** * @param \Sonata\AdminBundle\Form\FormMapper $formMapper * * @return void */ protected function configureFormFields(FormMapper $formMapper) { $formMapper ->with('General') ->add('username') ->add('name') ->add('surname') ->add('birthdate', 'birthday', array('format' =>...

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

php,symfony2,sonata-admin,symfony-sonata
I'm experiencing a problem trying to fit my Entities in the Sonata Admin Bundle. I have something like 5 entities, which are finely listed and viewed in the bundle, but I cannot edit or create a new entry. When I try to edit or create, I get a ReflectionException error:...

Sonata_type_boolean bugs

php,mongodb,symfony2,sonata-admin
I'm working right now with sonata admin bundle, in my model I have a Boolean attribute which I want display in my Edit view by : "yes" if the attribute is true, "false" if the attribute is false.. making this : ->add('istrue', null, array()) displays "1" if true and "0"...

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

php,mongodb,symfony2,sonata-admin
This question already has an answer here: PHP Parse/Syntax Errors; and How to solve them? 10 answers Good morning, I have a little problem using sonata admin bundle, let's suppose that I have a function which returns a String, I want to pass the result of this function into...

Set a field like choose in sonata Admin bundle

symfony2,sonata-admin,symfony-sonata
Hello I'm working with sonata admin bundle So I've a form to create, in which I need to select a Facultad entity from a list of these, this is the method to create and edit a Proyecto record. protected function configureFormFields(FormMapper $formMapper) { $em = $this->getConfigurationPool()->getContainer()->get('doctrine.orm.entity_manager'); $facultades = $em->getRepository('UIFIIntegrantesBundle:Facultad')->findAll(); $formMapper...

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

php,symfony2,sonata-admin,sonata
I installed all the Bundles of Sonata following the documentation step by step. I still have few errors to fix on some actions such as deleting images. All the errors i'm facing right now seem related. I submited two issues, one SonataMediaBundle and one in SonataClassificationBundle. Attempted to call method...

SONATA USER BUNDLE/FOS USER BUNDLE

symfony2,fosuserbundle,sonata-admin,sonata-user-bundle
It's my first time with this Bundle. I have a little problem to display correctly the side to register someone. In fact, the layout is duplicate. I don't know why. I spent lot of time but I have not the answer at the moment. I join a picture to...

DOCTRINE 2 Use two entities for one object

symfony2,doctrine2,sonata-admin
I am trying to update my database with this cli : php app/console doctrine:schema:update But I have a conflict "The table with name '...' already exists" because i Have two entities (one for the front and one for the back) and the both are linked to one table. I would...

SonataAdminBundle files uplaod to /tmp

php,symfony2,sonata-admin
When I load the files in SonataAdminBundle they are loaded into the tmp folder I have this entity: /** * * @var string * * @ORM\Column(type="text", length=255, nullable=false) */ protected $path; /** * @var File * * @Assert\File( * maxSize = "5M", * mimeTypes = {"image/jpeg", "image/gif", "image/png", "image/tiff"}, *...

Gedmo translatable / default locale and sonata admin bundle

symfony2,doctrine,sonata-admin,symfony-sonata
I am currently using the sonata admin bundle with the sonata translation bundle and gedmo translatable to localize my entities, which generally works nice. I have a category table with a field "title" which I'm localizing to a "category_translation" table. Now I can see, that the title in my default...

Symfony / Sonata Admin: List form on Edit form

php,symfony2,sonata-admin,symfony-sonata,sonata
I have a one (category) to many (product) relationship set up, and I'd like to have a list of products show up at the bottom of the edit category page. It seems like this would be a common thing to do, but I haven't found any way to do it...

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

php,symfony2,sonata-admin,symfony-2.6
I'm integrating Sonata Admin Bundle into my Symfony 2.6 application by following Symfony 2 jobeet tutorial. Everything is fine except the Show action. I have an entiry "Job" and so I have src/Ibw/JobeetBundle/Admin/JobAdmin.php which have a function configurShowField(ShowMapper $showMapper) like below <?php namespace Ibw\JobeetBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;...

Project Architecture

symfony2,doctrine2,sonata-admin
I was wondering if I did a good choice concerning my project conception. I am not an expert and it's the reason why I want to know the different views of the other developers. My project is separate in two Bundles : FrontOfficeBundle BackOfficeBundle I want to access my different...

Sonata + FOSUserBundle edit roles on edit form

symfony2,fosuserbundle,sonata-admin
I am using SonataAdminBundle for user administration. I would like to change roles on users. Currently my code in configureFormFields method is like this but roles are never updated and I don't know why. // Fields to be shown on create/edit forms protected function configureFormFields(FormMapper $formMapper) { $formMapper ->with('General') ->add('roles',...

No Entity Manager in Custom Class and ContextErrorException

symfony2,sonata-admin
I'm trying to create custom Form in Sonata-Admin and I want to get data from database to choices box. When I'm trying to get data via getEntityManager() I got error No entity manager defined for class \Admin\AdminBundle\Entity\Category I tried to add entity manager to first argument in service.yml [code below]...

Sonata Admin translation does not translate translation array

php,symfony2,sonata-admin,symfony-sonata,sonata
I am having a translation array in Sonata Admin that looks like this: messages.en.yml admin: form: label: identifier: identificationTitle: Some text here otherKey: blabla when I am trying to access it like this {{ 'admin.form.label.identifier.identificationTitle'|trans }} or like this {{ 'admin.form.label.identifier.identificationTitle'|trans({}, 'MyBundle') }} they don't work and I get as...

Only display some data Sonata

php,symfony2,sonata-admin
I just discovered Sonata and it seems really cool, but I can't find how to do simples things. For example I have a list of items with a one to many to an user entity, is it possible to only display items who belongs to the current user ? In...

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

symfony2,doctrine2,sonata-admin
I am doing a back-office with the SONATA ADMIN BUNDLE and I was wondering how you get your different entities in the back-office side to get all my different objects at home-page. It's could be very great to have something like the demo : http://demo.sonata-project.org/admin/dashboard. Has someone else experienced about...

Symfony2 - SonataUserBundle - user profile dashboard

php,symfony2,sonata-admin,symfony-sonata,sonata-user-bundle
How I can get user profile section to looks like this below? https://github.com/sonata-project/SonataUserBundle/blob/master/Resources/doc/reference/user_dashboard.rst My current profile pages looks ugly.. Do I need to rewrite all that *.html files or Sonata has implemented this layouts like in SonataAdminBundle and I need to change some configuration? I'm using: SonataUserBundle with FOSUserBundle, SonataAdminBundle...

Sonata Admin remove the batch column from list view

symfony2,sonata-admin
Symfony 2.3.25, SonataAdminBundle If i remove the 'delete' route from my admin by $collection->clearExcept(array('list')); in configureRoutes I get no 'batch' column in List View, which is what I want. But I need the 'delete' action. When I configureRoutes: $collection->clearExcept(array('list', 'delete')); I get the 'batch' column back, which I do not...

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

php,symfony2,sonata-admin,sonata-user-bundle
Compile Error: Declaration of Sonata\FormatterBundle\Block\FormatterBlockService::validateBlock() must be compatible with Sonata\BlockBundle\Block\BlockAdminServiceInterface::validateBlock(Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\BlockBundle\Model\BlockInterface $block) At the same time: PHP Fatal error: Declaration of Sonata\AdminBundle\Block\AdminListBlockService::validateBlock() must be compatible with...

Inline editable OneToOne relation in sonata admin bundle

php,symfony2,doctrine,sonata-admin
The sonata admin bundle provides functionality to edit entities inline when they are associated by a OneToMany relation. See http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/form_field_definition.html#advanced-usage-one-to-many Is there any way to get the same functionality for a OneToOne relation? So that I would be able to edit a child entity within my parent entity?...

How to separate folders using IvoryCKEditorBundle for file uploads?

php,symfony2,ckeditor,sonata-admin,sonata
I'm using the following in my project: Symfony 2.3 IvoryCKEditorBundle CoopTilleulsCKEditorSonataMediaBundle My intention is that users can create their own pages for showing different types of information. However, users are separated by a certain kind of relationship (certain users belong to a certain school, so only users from that school...

Sonata Admin Bundle configureRoutes getPersistentParameters

parameters,routes,sonata-admin
I'm quite new at Sonata. I have a proyect that involves Clients and Loans. In ClientsAdmin.php i have configured the configureRoutes and getPersistentParameters functions protected function configureRoutes(RouteCollection $collection) { $collection->add('transacciones','transacciones/{id}'); } public function getPersistentParameters() { if (!$this->getRequest()) { return array(); } return array( 'id' => $this->getRequest()->get('id'), ); } Also, i...

Can not use CRUDController

php,mongodb,symfony2,sonata-admin
I'm using sonata Mongodb AdminBundle for my back-end, in my case I need to create a new action for my user model ( sending a mail to him ), I followed the documentation literally https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_custom_action.html but I got a weird error : Compile Error: Cannot use Sonata\AdminBundle\Controller\CRUDController as Controller because...

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

symfony2,sonata-admin,sonata-user-bundle,symfony-2.6
I have installed Sonata Admin Bundle and User Bundle in my Symfony 2.6 application. I found that the User bundle creates a bundle at src/Application/Sonata/UserBundle. When I go to the admin user creation page (admin/sonata/user/user/create), I found a lot of fields there: General Username E-Mail-Address Plain password Groups Profile Date...

Updating symfony2 composer raise errors

symfony2,composer-php,sonata-admin
When I try to run command php composer.phar update it raise these error: Your requirements could not be resolved to an installable set of packages. Problem 1 - sonata-project/admin-bundle dev-master requires sensio/generator- bundle ~2.3 -> no matching package found. - sonata-project/admin-bundle dev-master requires sensio/generator- bundle ~2.3 -> no matching package...

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
This is my security firewall configuration: firewalls: # Disabling the security for the web debug toolbar, the profiler and Assetic. dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false # -> custom firewall for the admin area of the URL qis: pattern: /qis(.*) context: user form_login: provider: fos_userbundle login_path: /login check_path: /qis/login_check logout: path:...

Sonata admin enhanced view for security roles

symfony2,sonata-admin,symfony-sonata,sonata-user-bundle,sonata
In sonata admin the roles are based on admin services name with CRUD export and master permissions but the way it looks not so user friendly to create groups for others user or assign specific permissions to a user considering an example for sonata admin post module the service for...

Sonata - missing user security status labels

symfony2,sonata-admin,symfony-sonata,sonata-user-bundle,sonata
I don't know why but since today Status labels just gone... I can change Status but there is no labels so I don't what I'm doing ;-) app\config\config.yml imports: - { resource: @MyProductBundle/Resources/config/parameters.yml } - { resource: security.yml } - { resource: services.yml } - { resource: @MyProductBundle/Resources/config/admin.yml } -...