Questions tagged [sonata]
The Sonata Project is an open source set of bundles which are built on top of Symfony2.
690
questions
-2
votes
1
answer
21
views
How add verifications before update dados of an item using framework symfony?
I need to check information when updating an item, to know if saving is allowed or not. This must be done in the backend after the user have clicked on 'UPDATE' button. I'm using Symfony and the ...
0
votes
0
answers
17
views
EntityAuditBundle / Prevent DEL entry on Integrity constraint violation
I use the Sonata-Projects EntityAuditBundle in a API platform project to get a history for certain entities.
When attempting to delete a particular entity, it may not be possible to delete it because ...
0
votes
1
answer
47
views
sonata-admin: creating a voter
I am using Symfony 4.4 and sonata-admin 3.107
I created a voter for one of my admin pages (SampleAdmin).
class SampleVoter extends Voter
{
protected function supports($attribute, $subject): bool
...
0
votes
2
answers
75
views
Allow only ROLE_ADMIN to manage users in Sonata Admin
I have a Symfony 5.4 project using sonata-project/admin-bundle 4.9 and sonata-project/user-bundle 5.0.0-rc.1 and I want to let only the users with role ROLE_ADMIN to manage the users (CREATE/LIST/EDIT/...
1
vote
1
answer
68
views
Sonata Admin - how to add Translation to one field and getID of the object?
My code:
public function create($object): void
{
/** @var CarsEvent $object */
$carsEvent = $object;
$em = $this->getEntityManager($carsEvent );
$carsEvent->...
1
vote
1
answer
54
views
sonataadmin - add form field at the begining of the ertain existing tab only if condition is true
I have $form and some fields in the different tabs, that works okay, I want to add a field into the form
$this->getSubject()->getId()
if this condition is not NULL
What I did, after defining ...
0
votes
1
answer
71
views
Sonata admin datagrid filter can't get ChoiceType to work
I'm removing my hairs over this one. On sonata admin 3.x I had this filter in the list view, providing a select box with the options described.
protected function configureDatagridFilters(...
0
votes
0
answers
25
views
How to add Button in configureFormField in Sonata?
how can i display button in configureFormField in class Admin in sonata
1
vote
0
answers
56
views
How to handle project assets with NPM together with SonataAdminBundle?
Since version 4.x of SonataAdminBundle all assets are handled using NPM and WebPack.
In my project I also have some assets and JS libraries and I'm also using NPM and WebPack.
What should I do in this ...
1
vote
1
answer
96
views
How to control access to actions without override checkAccess and hasAccess methods
From version 3.102.0 of SonataAdminBundle a lot of methods in AbstractAdmin are marked as final.
The most important (in my opinion) "checkAccess" and "hasAccess" methods are also ...
0
votes
0
answers
112
views
Different GoogleAuthenticator Codes received on two different servers running the same code
This is a strange problem and just looking for some ideas of where to look, or what it could possibly be, please.
On my local dev machine, XAMPP PHP 7.1, sonata Google-Authenticator v2.2
When I do $...
0
votes
1
answer
66
views
Repository usage in configureActionButtons (Sonata Admin Bundle)
I am trying to inject doctrine service (if there is a way to inject BoothTypeRepository without Doctrine, that's also fine) into configureActionButtons and I can't find the way to inject nor doctrine ...
0
votes
1
answer
115
views
How to get container instance in sonata Admin class (v 4.0.0-rc.1)?
$this->getConfigurationPool()->getContainer();
The getContainer method doesn't seem to exist in version 4.0.0-rc.1
-1
votes
1
answer
342
views
phpinfo() shows opcache.blacklist_filename file, but contents ignored
In my Symfony/Sonata application's php.ini file, I have opcache.blacklist_filename set to /usr/src/app/config/opcache-exclude.txt. In a phpinfo() call on my test server, that file shows up in the ...
3
votes
1
answer
89
views
Preview column disappears when modifying Sonata Media Bundle
I am modifying the Sonata Media Bundle's media admin screen to show a new field. After using the Easy Extends tool to extend the bundle, I create a very small class to do this with:
namespace App\...
1
vote
1
answer
93
views
Dependency on a non-existent service "SonataMedia/MediaAdmin/inner_row_media.html.twig"
Using Sonata's Easy Extends tool, I am extending the MediaAdmin base class and overriding the existing service for that class. In doing so, I've converted this XML service definition (in the vendor ...
0
votes
0
answers
20
views
sonata_type_model not updating data, sonata_type collection not specific enough (oneToMany relation)
I'm trying to use sonata_type_model, everything worked just fine till I try to edit it.
{
$formMapper
->add('data1',null,array('label' => 'Unit'))
->add('data2'...
0
votes
1
answer
206
views
Sonata ModelAutocompleteType result affected by getFilterParameters
I have this form field of a type ModelAutocompleteType that is supposed to show the result filtered by the "search" datagrid field of related admin:
class OperationAdmin extends ...
0
votes
0
answers
154
views
Making a controller render a single custom template in a symfony project using sonata for the admin part
so after passing multiples hours on this problem, I must admit that I am stuck and I don't understand what I should be doing.
I am trying to make a specific controller render a custom template in a ...
0
votes
1
answer
169
views
No mapping file found when implementing TranslationInterface
I am using Ez-Extends to extend the Sonata Classification Bundle's Category entity.
Now I want to use the Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait to make my Category translatable. I ...
-2
votes
2
answers
176
views
"Enabled from" on a new Sonata Page Bundle site is invalid
I have a brand-new installation of Sonata Page Bundle. I am creating a Site entity using the Site admin screen.
I use the DateTimePicker that comes with the bundle to choose the "enabled from&...
0
votes
1
answer
108
views
sonata ecommerce - Impossible to invoke a method ("hasroute") on a null variable
I'm a fan of sonata projet, but setup e-commerce module is quite insane
I have created new product provider, i follow all theses steps https://sonata-project.org/bundles/ecommerce/master/doc/reference/...
0
votes
0
answers
62
views
Bug in Sonata Admin? Extra rows are added in list when selecting joined entities
Could this be a bug in Sonata Admin bundle?
Let's say I have an entity A that can have multiple B's. To see this in my database, I would write something like
select * from a inner join b on b.a_id = a....
0
votes
1
answer
229
views
Showing image previews Sonata Admin Bundle Could not load type "file"
I'm trying to show preview image with Sonata Admin Bundle 3 version but I can't do it. I get this error in RecipeAdmin.php: Could not load type "file": class does not exist.
RecipeAdmin.php
&...
-3
votes
1
answer
70
views
CALCUL WITH CONSTRUCTOR IN ENTITY SYMFONY
i need to do a calcul in an entity with symfony (sonata) like :
i have 3 labels in my entity with doctrine and i need to save in database a result of :
$calcul = $ a + $b ;
here is my entity
class ...
0
votes
1
answer
476
views
Symfony - Sonata admin - override validation
i'm using sonata admin, i tried to override max length allowed for name of categorie
I have an entity MyEntity who extend Application\Sonata\ClassificationBundle\Entity\Category
// MyEntity admin ...
0
votes
2
answers
49
views
Can I populate a Sonata entity export using only getters?
I am building a very simple billing system for a media company using Sonata that includes Payment entities for paying Reporters. The only purpose of a Payment is to be exported to a spreadsheet. We ...
0
votes
0
answers
28
views
SonataAdmin - configure rouites depends of security
Where can i change available routes depends of user ROLES ?
when i add
public function configureRoutes(AdminInterface $admin, RouteCollection $collection){
if(!$this->configurationPool->...
1
vote
3
answers
180
views
I can't install the user bundle from sonata
I'm triying to install the user bundle from symfony sonata with:
composer require sonata-project/user-bundle
following the documentation in:
https://sonata-project.org/bundles/user/4-x/doc/reference/...
0
votes
1
answer
611
views
Unable to generate a URL for the named route "admin_app_sonatauseruser_create" after renaming SonataUserUser entity
My application worked fine until I decided to rename SonataUserUser to User and SonataUserUserGroup to group.
This is how my user entity looks like
namespace App\Entity;
use Doctrine\ORM\Mapping as ...
0
votes
1
answer
224
views
Include null values in Sonata boolean filter
final class SomeAdmin extends AbstractAdmin
{
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper->add('sending_error', null, [
...
0
votes
1
answer
69
views
Write Basic HTML in sonata edit Tab
So in my sonata admin CMS, I'm trying to add a page called info
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->tab('Info')
->end();
}
...
0
votes
2
answers
540
views
Google Authenticator with PHP not working
im trying to make use of the project https://github.com/sonata-project/GoogleAuthenticator
I have first installed the project with: composer require sonata-project/google-authenticator .
after this ...
0
votes
0
answers
498
views
symfony 4.4 + sonata deprecations like sonata.deprecated_text.twig.extension | sonata.twig.deprecated_template_extension
I've installed sonata + symfony 4.4 on new clean empty project.
Did everything according to https://symfony.com/doc/current/bundles/SonataAdminBundle/getting_started/installation.html
and executed the ...
0
votes
1
answer
130
views
SonataMedia Bundle: Create Media Entity throws "is_file() expects parameter 1 to be a valid path, string given"
I want to create an image media entity (using SonataMediaBundle) with the following code:
$media = new Media();
$media->setBinaryContent($binaryImageContent);
$media->setContext('default');
$...
0
votes
1
answer
219
views
Sonata, Symfony, Password Encryption, Doctrine Listerner/Subscriber
Infos : I'm new to Symfony and Sonata
My objective : Encrypte the password only for the database side. I would be able to display this password in clear. All this for the field password in the entity ...
0
votes
0
answers
32
views
Symfony / Sonata : drop-down with an input field [duplicate]
I'm trying do this kind of code but under sonata/symfony framework
<input type="text" name="city" list="cityname">
<datalist id="cityname">
<option value="Boston">
...
1
vote
1
answer
82
views
Sonata/Symfony using MongoDB filtering for Null
I'm trying to customize a filter in sonata admin that returns all the objects that have null on one specific field... In MySQL, there was a function that I used to get the null values which were the ...
0
votes
2
answers
415
views
import data from Excel file through phpspreadsheet and check existence of records in the database symfony 4
I would to import data from Excel file through phpspreadsheet and read row by row and test if the record exist in the database as follows
$reader = new XlsxReader();
$spreadsheet = $reader->load($...
0
votes
0
answers
31
views
class extend SonataPagePage column not found
I just installed Sonata Page-Bundle, and want to create another page type.
Right now there is the default content types: site, page, block etc. I want to create an entity Article, which extends the ...
2
votes
2
answers
358
views
Cannot install sonata admin on Symfony
I installed symfony 4.4 full, and then tried to install sonata-project/doctrine-orm-admin-bundle.
Out of the box, this doesn't work. can someone please explain this?
I got the same error using symfony ...
-2
votes
1
answer
285
views
sonata admin-bundle in Symfony 3.4
I'm using the following command: composer requires sonata-project/admin-bundle but it is installing the latest version of sonata which is not compatible with Symfony 3.4
i am getting the following:
...
0
votes
1
answer
42
views
Building Backoffice without SonataUserBundle
I am in the process of migrating a project from Symfony 2.8 to 3.4.
In this project , I used sonataUserBundle as a dependency ( before migrating ) which unfortunately does not work in Symfony 3.
So, I ...
0
votes
0
answers
384
views
Composer require sonata-project/core-bundle in Symfony 3.4
I'd like to add sonata-project/user-bundle to Symfony 3.4 project but i received the following error message, BTW, i already installed "sonata-project/doctrine-orm-admin-bundle" :
composer ...
0
votes
1
answer
87
views
Use ModelListType withour relation in SonataAdmin
Is possible to use ModelListType::class without relation ?
i try this way
$admin = different Admin object
->add('partner',ModelListType::class,[
'mapped'=>false,
...
0
votes
1
answer
286
views
CKEditor problem with SonataFormatter + SonataNews in Symfony 4.4
I'm trying to integrate SonataNewsBundle in Symfony 4.4.
The CKEditor is not showing in the "Content" field for the news post.
I've read through probably all of what's to be found online and ...
0
votes
0
answers
29
views
Can't see arrow in datapicker in symfony 2.8
I don't have a lot of experience with symfony, but im trying to show arrow in datepicker in symfony. Any ideas, why i cant see them? Im using symfony 2.8.
Image:
picture
fragment of my build form ...
0
votes
1
answer
127
views
sonata Admin current entity
How can i access the id of a sonata admin entity. suppose i have an entity EndPoint which have a function getProject(), how can i get the id of that project. I tried the code bellow but this gave me ...
3
votes
0
answers
284
views
join on subquery in Sonata Admin/ Symfony doctrin-orm query-builder
When I try joining the subquery in the following function of a Sonata Admin Panel Class
protected function configureQuery(ProxyQueryInterface $query): ProxyQueryInterface
I always get the following ...
0
votes
1
answer
162
views
Sonata Admin: One-to-many route to show action instead of edit
My problem is simple, but I can't find an answer anywhere in the docs or the code...
When configuring show fields for a one-to-many relation, the records correctly appear in a list on the show page. ...