Questions tagged [symfony]

Symfony refers to both a PHP framework for building web applications as well as a set of components on which the framework is built. This tag refers to the currently supported major versions 2.x, 3.x and 4.x. Alternatively you can specify an exact version using the respective tag. This tag should not be used for questions about Symfony 1.x. Please use the Symfony1 tag instead.

Filter by
Sorted by
Tagged with
1
vote
1answer
15 views

Symfony 4 - Problem with DQL for ordered array

I have a "Validateur" entity like : Validateur : -id -Validateur (User relation ) -Ordre (could be 0,1,2 ... ) And GroupeValidateurs entity like : GroupeValidateurs: -id -validateurs (ManyToMany ...
0
votes
0answers
8 views

Using Symfony Doctrine Migrations with Gitlab CI: GitLab CI interprets “Nothing to migrate” as error

We are using the Doctrine migrations bundle for update database in our deployment process. Currently, we are switching to Gitlab-CI. The problem: The CI is aborting the deployment process because the ...
1
vote
1answer
22 views

Symfony4: Doctrine OneToMany relationship in a form throws error 'Could not determine access type for property “X” in class “Y”'

I have a parent form with many collection but i want to limit the number of the collection so I created criteria to limit the number of result to 8 this works fine for the display but not while ...
1
vote
1answer
22 views

$parent->addSalle($child) generate uneeded extra query

I'm currently optimizing doctrines queries, and noticed that doctrine generate extra queries on data it already got in the unit of work (UOW). Yet, when I try to add/associate child objects to it's ...
1
vote
1answer
14 views

How to test dependency injection with PHPUnit on symfony 4

In a symfony 4 project, many services/controllers need log. Trying to use the advantage of traits & autowire options given by symfony, I created a loggerTrait that will be passed to the different ...
0
votes
0answers
35 views

Symfony 4 forms use existing model

I have a Symfony entity and simple form. I want to use existing object from database instead of creating one: Entity: class Section { /** * @var integer|null * @ORM\Id() * @ORM\...
0
votes
0answers
11 views

APYDataGridBundle: How to filter a column, based on the value of another column?

I'm using APYDataGridBundle to display a table of users (Entities in database). Each user has a "parentid", which is referring to the id of the parent user obviously. If a user has no parent, the ...
1
vote
0answers
31 views

Symfony 4 worker using doctrine not working properly : SQLSTATE[HY000] [2002] Connection timed out

I'm using a worker with the symfony 4 messenger component. This worker is receiving a message (from rabbitMQ) launch ffmpeg do a treatment on a video and save something in a database. To configure ...
0
votes
1answer
19 views

add model transformer to custom form type (only parent)

I am building my special choice type. class MyType extends AbstractType { public function getParent() { return ChoiceType::class; } public function buildForm(FormBuilderInterface $builder, ...
0
votes
1answer
27 views

How to fully reset doctrine for performance

I have a Symfony application with Doctrine. I need to create a command that will iterate through several thousands of records from the database, retrieving related data and processing it. As ...
1
vote
1answer
27 views

Can't add a “bin/console” command and run it in Xdebug in PhpStorm

In PhpStorm, under Edit Configurations -> Run/Debug Configurations I don't see an option to add a bin/console command, or can I use Shell Script if what is the correct syntax to add the command?
2
votes
1answer
25 views

How to select a group of entities according to a condition in a related OneToMany association?

I'm using Symfony4 and I have two entities User and Car. A Car has a field isRent which is of type bool and further a database column user_id for the relation. class User { /** * @var ...
1
vote
1answer
44 views

How to set up a delete confirmation modal in symfony 4

I'm a beginner in Symfony and i want to set up a modal of confirmation of deletion in my Symfony 4 application. I wish this modal is present in all the pages thus to be placed in the file base.html....
0
votes
1answer
17 views

Symfony how to change user password with SonataAdmin?

I have an Admin class for sign into administrator page, It is implements UserInterface: ** * @ORM\Entity(repositoryClass="App\Repository\AdminRepository") */ class Admin implements UserInterface { ....
2
votes
1answer
69 views

Twig automatically removes apostrophe and quotation marks

I've created my own TransTokenParser for the sake of learning (parsing {% trans %} and {% trans with %}) -> and the parser itself works good except for the latter variant: trans with. The parser ...
0
votes
1answer
42 views

Form in modal is not writing new user data to Database

I am trying to register new user in a modal, but I can not succeed. In home/index.html.twig I am displaying modal by AJAX: <div class="cell large-3 t-white bg-dark offset-2 pt-2"> <...
0
votes
0answers
22 views

How to add doctrine entity manager programmatically from controller?

I have a controller method where i added doctrine connection and doctrine entity manager programmatically to the config.yml. When i try to get the entity manager i just added via $doctrine->...
-1
votes
0answers
27 views

Why got a syntax error on CurlHttpClient?

I try to use symfony mercure bundle in my symfony app. I follow this documentation. When I did the composer require mercure I got not error. But when I try to access my controller to publish some ...
0
votes
0answers
11 views

doctrine:mapping:import from existing oracle database not possible

I'm using an oracle db 12c with a table "data.account", "data.users" and "data.service". I've created a separate user "api" with "select" permissions on these tables. Then i've created a new symfony ...
1
vote
1answer
37 views

SwiftMailer not sending emails using Symfony 4?

I am in mode development, I am working on localhost, I am trying to send and email via swiftmailer but I get no error, but no email is sent too, I am stuck for almost 6 hours trying to copy and past ...
0
votes
0answers
30 views

Trouble for deploy Symfony 4 on my ftp server

I'm a dev from symfony 3.3 and i would like to have migrate on symfony 4 but everything i try didn't word for having a working build on my ftp server. I have install composer Download the ...
0
votes
1answer
40 views

Symfony 3.4 Array to string conversion when trying to display flash messages

I have to be missing something here, just trying to set a flash message in a new project. In controller: $this->addFlash( 'success', 'Your entry was added!' ); In my template, I include: ...
0
votes
0answers
34 views

Symfony 4 custom logger with multiple channel

I want to make one Logger class which can be use in different modules in Symfony and when logging to have different channels. Here is my configurations: service.yaml App\Logger\MLogger: ...
0
votes
1answer
29 views

Symfony 4.3 Doctrine Migration issue

I'm having an issue with the doctrine:migrations:migrate. I ran a version called " 20190819021520" a few days ago and worked just fine. Database was updated and had no issues. Today I'm trying to do ...
-1
votes
0answers
34 views

Symfony 4 - “UNIQ” constraint problem on my entity

I've an entity "Validateur" on my symfony 4 project. Like this : namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Gedmo\...
2
votes
0answers
37 views

Can't debug Symfony with ContainerAware command function

I get the following error in Symfony 3.4 when I trying to extend the BaseCommand and run the code in Xdebug. [docker://mysite:dev/]:php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug....
1
vote
0answers
25 views

How to get publicly visible URL for image in Sonata Admin?

I am using SonataAdmin and Symfony4, i do not use SonataMediaBundle. I can store images but now i want to show preview images. In docs Sonata Docs sad that i need to retrieve a publicly visible URL ...
0
votes
1answer
24 views

Symfony 4 forms OneToMany foreign key null violation

When I submitting form and persisting Object model I got SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "object_id" error. I have two Doctrine entities: class Object { /** ...
0
votes
1answer
24 views

Data required for app to run - where should it be kept? [on hold]

More like a "best practices" question. Let's say I have an app, that requires some data in the database to run properly. Real data that will land on production environment. A set of user roles maybe. ...
0
votes
1answer
39 views

how and where to execute custom queries in symfony 4

I am using an entity class which extends ServiceEntityRepository like this: class Sms extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::...
0
votes
1answer
35 views

Symfony 4 file upload with entity

I'm working on my module and one part is where you can add new backgrounds to the database to use in a slideshow. I have a SlideshowBackground entity with 3 properties: /** * @ORM\Id() * @ORM\...
2
votes
1answer
16 views

SonataAdmin how to set default value for ModelAutocompleteType

for example: I have an article belongs to category, class ArticleAdmin extends AbstractAdmin{ protected function configureFormFields(FormMapper $formMapper) { $formMapper -&...
0
votes
0answers
23 views

Make security available for doctrine onFlush within functional test

I'm actually testing my api code written with: symfony 4 api-platform FOS User JWT I use codeption for my tests and everything is ok so far. For several entities, I fire onFlush doctrine callback ...
-2
votes
1answer
37 views

how can i fix this bug on my code?i am working on a crud api and i keep having errors on the post function [on hold]

i am new on coding and i'm working on a crud api and i'v got some issues with the post method public function postValuablesAction(Request $request): Response { $valuable = new Valuables(); $...
-1
votes
0answers
34 views

Why Symfony uses the same alias for multiple services? [on hold]

While reading the document regarding Symfony alias, I checked some service definitions from Symfony and found something like this: <service id="router" alias="router.default" public="true" /> &...
1
vote
2answers
46 views

How to display console prompt for “choice()” in columns?

In a Laravel command, I am looking for a way to display the 52 options in multiple columns rather than one long list that requires scrolling. Is this possible? This is the code I have so far: do { ...
0
votes
2answers
47 views

PUT not updating entity

I can't seem to update an entity when making a PUT request. It works fine when I want to modify single elements belonging to the entity but not anymore as soon as I try to update an array or an ...
0
votes
0answers
43 views

Symfony 4 - Problem to position my buttons

I use the jQuery collection plugin : https://symfony-collection.fuz.org/symfony3/ to manage my groups. For the moment I've : And I would like that my buttons go at the same row that my fields, like ...
1
vote
1answer
19 views

How to test a server API (REST) including interactions from multiple users/clients with symfony?

We have a supplier that develops a linux-server for us exposing a REST API. We are developing a client application that uses this REST API. Multiple clients running this client applications work ...
-1
votes
0answers
33 views

How to solve EventSubscriberInterface implement error in Symfony api-platoform? [on hold]

As per the doc I did following code but I'm getting following error: In PasswordHashSubscriber.php line 14: Error: Class App\EventSubscriber\PasswordHashSubscriber contains 1 abstract method and ...
0
votes
2answers
31 views

Symfony 4: Returning only active records

I would like to only get records where the active indicator is true: class Question { /** * One Question has one Figure * @ORM\OneToOne(targetEntity="QuestionFigure", mappedBy="question") ...
0
votes
2answers
24 views

Symfony 3.2 Form best way to add a filter on textfield to remove unwanted Characters

I am using Symfony 3.2. I have a text field on a Symfony form. I would like to apply a "sanitize" function on form submission. What is the best way to do this? Here is a snippet of the form. The filed ...
1
vote
1answer
36 views

401 error When sending incorrect credentials using JWT?

So I am working with JWT, When I insert a valid data ( username and password ) I get a response with 200 in status, but I insert an incorrect data I get 401 error with a message saying Bad credentials,...
0
votes
1answer
35 views

My url is working in Postman but Not working when using it from a browser?

I hope you are doing fine, I have a small problem, I am devolopping an API using Symfony 4, and Working with ReactJs in the frontend, So I am sending my data to the server using axios, here is it : ...
0
votes
0answers
9 views

Symfony2.8 : Failed to authenticate on SMTP server with username “[email protected]” using 2 possible authenticators

Using Postfix to configure my smtp mailing : postconf -n 2bounce_notice_recipient = [email protected] alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases append_dot_mydomain =...
0
votes
1answer
52 views

Cannot set mapped association Id during PrePersist event

I have an article entity belongs to a category entity: /** * Article * * @ORM\Table(name="articles") * @ORM\Entity(repositoryClass="App\Repository\ArticlesRepository") * @ORM\...
0
votes
0answers
53 views

Symfony 3.4 populated the TokenStorage with an anonymous Token

I have a Symfony 3.4 project runninng on PHP 7.2 both on my PC and on the hosting server. In the prod environment the logged in user can't submit a form. So it matches the redirect route, which ...
0
votes
0answers
29 views

Symfony: Reference the versioned image in vue component

I'm using webpack encore in a symfony + vue application to build assets with the .enableVersioning() option on but i don't know how to reference those versioned images in the vue components. Usually, ...
-4
votes
0answers
40 views

Composer shows conflict between 2 compatible packages [duplicate]

(That same question was closed but I think it's legitimate. I'm trying to reformulate?) I have an error trying to composer install my dependencies. Same error with composer update. It says there's a ...
-1
votes
1answer
77 views

Composer shows conflict between 2 compatible packages (original)

I have an error trying to composer install my dependencies. Same error with composer update. It says there's a conflict between symfony/web-server-bundle 4.3.3 and symfony 3.4 but those packages are ...