sonata-admin

Cannot setup sonata using composer

时光毁灭记忆、已成空白 提交于 2019-12-10 11:45:17
问题 I have set up symfony using composer. I have added some dependancies in my composer .json file like so: { "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.*", "doctrine/orm": ">=2.2.3,<2.4-dev", "doctrine/doctrine-bundle": "1.2.*", "twig/extensions": "1.0.*", "symfony/assetic-bundle": "2.3.*", "symfony

Sonata Admin Bundle - add a multi step batch action

谁说我不能喝 提交于 2019-12-10 11:43:05
问题 I need to add a custom batch action to my SonataAdmin entity that allows the user to select a number of items in the list view, then select the custom batch action (called 'edit dates') then... and here's where I'm stuck... display a form with two date fields that, when submitted, updates the selected list items with the inputted dates. Is it even possible to have a multi-step batch action like this in SonataAdminBundle? 回答1: You can add your date fields to the template: {# in Acme

Sonata Admin ManyToOne error: “sonata_type_collection - mapping : 2 ”

流过昼夜 提交于 2019-12-10 10:57:04
问题 I want to use Sonata Admin Gallery feature into my News Entity . Here is my code News.yml .... manyToOne: gallery: targetEntity: Application\Sonata\MediaBundle\Entity\Gallery inversedBy: news_gallery cascade: ["persist"] nullable: true Gallery.orm.xml .... <one-to-many field="news_gallery" target-entity="Wenweipo\NewsBundle\Entity\News" mapped-by="gallery" /> NewsAdmin.php protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('gallery', 'sonata_type_collection',

How to extends Sonata\DoctrineORMAdminBundle\Model\ModelManager

陌路散爱 提交于 2019-12-10 10:37:41
问题 I want some changes in ModelMangaer then I was extending ModelManager but It's not working. I don't know why ? Any one tell me why it is not working? File where I extend Sonata\DoctrineORMAdminBundle\Model\ModelManager-> <?php use Sonata\DoctrineORMAdminBundle\Model\ModelManager; class ModelManager extends ModelManager { /** * {@inheritdoc} */ public function getSortParameters(FieldDescriptionInterface $fieldDescription, DatagridInterface $datagrid) { $values = $datagrid->getValues(); $values

How to get images listed in sonata admin bundle backend

こ雲淡風輕ζ 提交于 2019-12-10 10:35:56
问题 I want to get my image thumbnail listed in list area, i don't know how to do that, can any one please help me. I Got my caption in back end. I am using Sonata adim bundle and following its official document. here is my imageAdmin.php namespace swaam\ImageUploaderBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Form\FormMapper; class ImageAdmin extends Admin { // Fields to be

Adding a custom form inside the show template of a Sonata Admin Entity

99封情书 提交于 2019-12-10 03:26:10
问题 I want to generate a small form inside a Sonata Admin show template. What I have done so far is creating the function in the custom CRUD for that specific entity (order) that extends from Sonata's default CRUD; public function approveOrderAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $order = $this->admin->getObject($id); $approveForm = $this->createFormBuilder($order) ->add('reqSecondApprover', 'checkbox', array('label' => 'Require

Sonata User Admin - Custom field dependency

China☆狼群 提交于 2019-12-09 13:42:17
问题 I have extended the SonataAdmin class for FOSUser and added 2 custom fields (choice type from external data source): Company and Sector I'd like to make Sector dependent on Company , so if the user selects a Company it filters the available Sectors. I though about using FormEvents for filtering at page load, but I don't even know how to get the Company value of the current form. Here is a part of my custom SectorType public function buildForm(FormBuilderInterface $builder, array $options) {

Sonata and Gedmo\\References doctrine extension doesn't work ( Class does not exist )

人盡茶涼 提交于 2019-12-08 12:55:32
I want to link the doctrine orm entity and doctrine odm document and use them in sonataAdminBundle in configureFormFields Method of the Admin Class. I've established the @Gedmo\References doctrine-extension and it works just fine when i'm trying to access the linked models from controller. But now I need to do it from SonataAdminBundle - to make an UI to add the linked documents to the user entity. Here is my entity: <?php namespace Application\Sonata\UserBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Sonata\UserBundle\Entity\BaseUser; use FOS\UserBundle\Model\GroupInterface; use Sonata

Sonata Admin configureListFields show through query

蹲街弑〆低调 提交于 2019-12-08 11:17:27
问题 I am using sonata admin bundle for admin panel. I want to show data in configureListFields through query. I have table userChoiceProduct and fields :- User_Id Product_Id These fields automatically fill when user select any product and submit form. But these fields no relationship to other table.and I want to show User Email and Product Name in configureListFields bases on User_Id and Product_Id. Thanks! 回答1: I solved this:- In Sonata Admin list :- ->add('User Email', null, array('template' =>

Custom Home page sonata page

隐身守侯 提交于 2019-12-08 09:50:16
问题 I create my custom controller for the page home. controller: class FrontPageController extends Controller { public function homeAction() { return $this->render('FrontPageBundle:Page:home.html.twig'); } } routing.yml front_page_home: path: / defaults: { _controller: FrontPageBundle:FrontPage:home } but the url to my controller redirects to the controller sonata.page.page_service_manager:execute route: "page_slug" 回答1: I found a solution but I don't know if it is good practice or not. I create