sonata

Can I use prePersist/preUpdate in Sonata Admin controller to persist more than one object?

折月煮酒 提交于 2019-12-10 15:48:27
问题 I have this Alias entity: use Gedmo\Timestampable\Traits\TimestampableEntity; class Alias { use IdentifierAutogeneratedTrait; use TimestampableEntity; use ActiveTrait; /** * @var string * @ORM\Column(type="string", length=150) */ private $name; /** * Command associated to the alias. * * @var Command[] * @ORM\ManyToMany(targetEntity="Command", mappedBy="aliases", cascade={"persist"}) */ private $commands; ... } And I have this Admin controller: class AliasAdmin extends Admin { protected

Batch multi step and/or form multi step in sonata admin bundle

最后都变了- 提交于 2019-12-10 15:16:32
问题 I have make search but I found nothing that help me. I use sonata admin bundle and first I want to know if it's possible to make multi step form. Second, I'd like to make a new batch action (this step is ok for me), but after user chose the batch action I want a form with field that I can use in my custom batch action. I have see it's possible to add field next the batch action list but this field are visible for all batch action for me I would like the user first chose the batch action and

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

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

SonataProductBundle (symfony 2.8) instead of showing product create form there is “No object types available” button appearing

倾然丶 夕夏残阳落幕 提交于 2019-12-08 06:15:35
问题 There are Sonata Admin with enabled SonataProductBundle. Product entity configured accordingly to documentation. But, upon attempting to create new "Product" in admin panel, "No object types available" button appears instead of edit form of. Here are the configurations: config.yml imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: services.yml } - { resource: sonata/sonata_product.yml } - { resource: '@ApplicationSonataProductBundle/Resources/config/product.yml

Exporting one to many relationship on sonata admin

怎甘沉沦 提交于 2019-12-05 10:42:16
I have tried to search online for a definite solution to this question but there's really no concrete solution for newbies out there. I have an Entry which has many EntryListing. In my EntryAdmin listMapper, i comfortably can list entries by a statement as simple as ->add('listings') which simply returns the listings as defined in the EntryListing __toString() function. Is there a way to achieve the same when exporting the data by overiding the getExportFields() functions as below: public function getExportFields() { return array('name','tel','email','deviceType','postedOn','createdAt',

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

我与影子孤独终老i 提交于 2019-12-05 02:50: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 second Approval', 'required' => false)) ->add('secondApprover', 'choice', array('choices' => Crud:

SonataMediaBundle - S3 AWS: 'The configured bucket “my-bucket” does not exist

落爺英雄遲暮 提交于 2019-12-03 20:13:23
I'm trying to configure the AWS s3 filesystem on my Sonata-Project, but I always get the following error: The configured bucket "my-bucket" does not exist. My sonata_media.yml : cdn: server: path: http://%s3_bucket_name%.s3-website-%s3_region%.amazonaws.com providers: image: filesystem: sonata.media.filesystem.s3 file: resizer: false allowed_extensions: ['pdf'] allowed_mime_types: ['application/pdf', 'application/x-pdf'] filesystem: s3: bucket: %s3_bucket_name% accessKey: %s3_access_key% secretKey: %s3_secret_key% region: %s3_region% I added the following parameters to my parameters.yml: s3

Use Sonata Field Type on normal Form Class

血红的双手。 提交于 2019-12-03 17:22:43
I'm trying to insert custom sonata form field type on the front page, not in SonataAdmin, something like this: $form = $this->createFormBuilder($content) ->add('titleEs', 'text', array('required' => true, 'label' => 'label.title.spanish', 'attr' => array('class' => 'col-xs-12 form-control input-lg'))) ->add('contentEs', 'ckeditor', array('required' => true,'label' => 'label.content.spanish', 'attr' => array('class' => 'col-xs-12'))) ->add('titleEn', 'text', array('required' => true,'label' => 'label.title.english', 'attr' => array('class' => 'col-xs-12 form-control input-lg'))) ->add(

Symfony Sonata Media Bundle add images/videos to a user

本秂侑毒 提交于 2019-12-03 13:18:40
问题 I am trying to integrate Sonata Media Bundle in my project. The problem is, that i don't understand how the bundle works. It has generated a Media, Gallery and GalleryHasMedia class within 'Application'. What are they for? How can I now add an images field and a videos field to my User Entity ? (both plural) Regards, nova 回答1: Media is the Entity that saves all the properties of your video / picture : width / height / file path... The Entity Gallery is useful if you want to link multiple