sonata-admin

Sonata Media Bundle : acces media url

ε祈祈猫儿з 提交于 2019-12-30 04:04:13
问题 I am using sonata media bundle. and I was wondering how can I access the media url in twig. I just want the url, I do not need to show the media. Any suggestions? 回答1: You have to use the path media helper: {% path media, 'small' %} In the above code, media is an instance of the media entity, and small is the chosen format. http://sonata-project.org/bundles/media/master/doc/reference/helpers.html#twig-usage 回答2: But if you do not want to render the media right there and just store the url in

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

五迷三道 提交于 2019-12-29 09:50:11
问题 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 of birth Firstname Lastname Website Biography Gender Locale Timezone Phone Social Facebook Uid Facebook Name Twitter Uid Twitter Name Google+ Uid Google+

Sonata Admin Bundle One-to-Many relationship not saving foreign ID

假装没事ソ 提交于 2019-12-29 04:02:40
问题 I have a problem with the SonataAdminBunle in combination with symfony 2.2. I have a Project entity and a ProjectImage entity and specified a One-to-Many relationship between these two like so: class Project { /** * @ORM\OneToMany(targetEntity="ProjectImage", mappedBy="project", cascade={"all"}, orphanRemoval=true) */ private $images; } class ProjectImage { /** * @ORM\ManyToOne(targetEntity="Project", inversedBy="images") * @ORM\JoinColumn(name="project_id", referencedColumnName="id") */

Custom Action leading to filtered list with multiple parameters?

寵の児 提交于 2019-12-25 09:25:28
问题 I need that my custom action button leads to a filtered Sonata List (Curriculum), but I need to use two parameters (Company and External). Previously, I have been using this approach: Sonata Admin Action Button to Pre Filtered List, but I couldn't manage to use two parameters at the same time. <a class="btn btn-sm btn-default" href="{{ path('admin_myvendor_mybundle_curriculum_list',{'filter[companies][value]' : object.id }) }}"><i class="fa fa-university"></i> Curriculums </a> Any idea how to

Custom Action leading to filtered list with multiple parameters?

家住魔仙堡 提交于 2019-12-25 09:21:01
问题 I need that my custom action button leads to a filtered Sonata List (Curriculum), but I need to use two parameters (Company and External). Previously, I have been using this approach: Sonata Admin Action Button to Pre Filtered List, but I couldn't manage to use two parameters at the same time. <a class="btn btn-sm btn-default" href="{{ path('admin_myvendor_mybundle_curriculum_list',{'filter[companies][value]' : object.id }) }}"><i class="fa fa-university"></i> Curriculums </a> Any idea how to

A2lixTranslationFormBundle with Stof DoctrineExtensionsBundle doesnt Show Any Tab

空扰寡人 提交于 2019-12-25 07:49:14
问题 I'm new to Symfony and Sonata. After following the instructions i installed Translatable, but i dont get any Tab in the form. Composer.json "stof/doctrine-extensions-bundle": "1.1.x-dev", "a2lix/translation-form-bundle": "2.x-dev" config.yml # Doctrine Configuration doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: UTF8 # if using pdo_sqlite as your database

Show child table clickable link along with Add/Edit screen of parent table Sonata Admin Bundle

痞子三分冷 提交于 2019-12-25 05:08:12
问题 I am working on Sonata admin bundle in Symfony2.3.3. I have a parent table and a child table which has a foreign key. Right now I am showing the Add/Edit screen of parent table. Is it possible to show the child table foreign key also along with the Add/Edit screen of parent table? And when clicked it should go to the Add/Edit screen of child table. Please help me. I googled much and have been with this for quite sometime now only to not find a suitable answer. Thanks in advance. 来源: https:/

Symfony 2 - path to template

末鹿安然 提交于 2019-12-25 03:19:16
问题 I have no idea why my path to template isn't working. I have heard that everything is ok and it should be working, but it isn't. ..\project\src\Application\Sonata\AdminBundle\Resources\views\CRUD\list_image.html.twig ->add('photo', null, array('template' => 'ApplicationSonataAdminBundle:CRUD:list_image.html.twig')) But when I try to fire the project, I get this error from log: [2014-10-15 10:28:59] app.WARNING: An error occured trying to load the template "ApplicationSonataAdminBundle:CRUD

Catch “Integrity constraint violation: 19 FOREIGN KEY constraint failed” when deleting restricted entries

三世轮回 提交于 2019-12-24 10:54:01
问题 The question relates to the technology stack I use: Symfony 4.2.3 Doctrine ORM 2.6.3 Sonata Admin 3.45.2 sqlite3 3.22 (although the RDBMS shouldn't play a role) Let's say we have two entities: Category and Product where the relation category to product is 1:n and product to category is n:1. This would look like: Category.php class Category { // ... /** * @ORM\OneToMany( * targetEntity="App\Entity\Product", * mappedBy="category", * cascade={"persist"} * ) * @Assert\Valid() */ private $products

how to create custom list with sonata admin

為{幸葍}努か 提交于 2019-12-24 09:25:06
问题 I can't find (understand) how to add items and cathegories to Left Side Admin Menu. There is no detailed tutorial how to do this. I can add items to sonata.admin.block.admin_list but to aside Admin Menu enter image description here 回答1: Since the menu is automatically built by traversing the registered admins there is no (to me known) simple solution for that by adding just an admin service entry. But it's quite easy yet. You could register a MenuBuilderListener and add new items as many as