Questions tagged [symfony4]

Symfony is a PHP framework developed by SensioLabs. Symfony 4 was released November 2017.

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Symfony 4: Embed form child Create New On Update

This is what I've done so far: I have a Patient(parent entity) and a File(child entity) each Patient is created with two files when the patient is edited I could edit the two files. What's needed : ...
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 ...
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, ...
1
vote
1answer
24 views

How to make a query builder that find Properties based on Request

I have a estate web app in symfony4 and I have db sql structure : tables(Requests - any client can request to buy a property, Properties - the actual buildings, Fields - the dynamic field type used ...
0
votes
2answers
12 views

Button Inside DataTable Unable To Click After Ajax Reload

I have a datable that each rows have two buttons "Cancel" and "Update". When the page starts loaded, i can click both of the cancel and update buttons. But after call ajax and add rows into a ...
0
votes
1answer
19 views

Set a default value in form only if my user hasrole : ROLE_USER [symfony 4]

I have a reporting request form. I would like the administrator to create a request for a user if needed. So I have a field that will either be blocked if the user has a certain user role or the ...
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"> <...
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
8 views

symfony WebProfile data storage format

As of code symfony WebProfiler uses serialize and unserialize to store data, but when i open the profile it shows something like this, can you tell me what datatype is this
2
votes
1answer
17 views

Invalid YAML preventing me from sending an email?

So I am workig on a Symfony API, I am trying to send an email via SwiftMailer, I set it my code right, I tried to set my configuration file too, but I think I am getting an error. Here is my ...
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
0answers
24 views

Symfony4: Sharing services between App and bundle

This question is about sharing services between bundle and App, when you want to create reusable bundle. I'm new to symfony so It's possible that I'm missing a concept. So, I have created App which ...
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 ...
0
votes
0answers
9 views

Doctrine2 - How to define table prefix for orm mapping [duplicate]

I have a question regarding doctrine2 mapping configuration. I need to store in my database 2 logicaly separated sets of data, so I wanted to have them also separated in code. I store my entities in ...
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\...
0
votes
1answer
35 views

How do access a service from the container, with its dependencies already resolved; from where ever I want?

I want to create a new service where I will load the dependencies into the service. I then want to be able to access that service knowing that the dependencies are already resolved and injected. How ...
-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") ...
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,...
1
vote
0answers
34 views

Which class to extends when overriding UrlMatcher in Symfony 4?

Coming from SF3, I have to resolve the router deprecated class parameters issue. I'm trying to override the URL Matcher (to handle the locale on the URL in a custom way). Right now I see 2 classes: ...
0
votes
0answers
17 views

Symfony 4: Image not found or type unknown after downloading PDF using dompdf

I am getting the error "Image not found or type unknown" after downloading PDF in Symfony 4 using dompdf package. My method in my controller class: public function dompdf(EvaluationRepository ...
1
vote
1answer
30 views

How to make sure supervisord worker (php) is running fine on GAE flex env?

I am using symfony 4 with app engine flex env. I wrote a symfony console command which is meant to be running long term. Docs says that GAE has supervisord in place so I can use it to manage the ...
0
votes
1answer
25 views

Problems to include external library without composer

I have downloaded an external Php library, which is mandatory to work with its API. That library does not meet the standards psr-0 and psr-4, so it is impossible to load it as a service, nor with an ...
1
vote
1answer
33 views

How to use different connection settings when running Doctrine migrations in Symfony?

I have Symfony project with pgSQL DB. I have two db users, one with select/update privileges for web (lets call it usr_web) and a second one with create/alter table for migrations (usr_admin). I'd ...
-3
votes
0answers
53 views

Symfony 2.8 to 4.3 upgrade [on hold]

I am interested in knowing what is the feasability of upgrading an existing project from Symfony 2.8 directly to 4.3 ? Basically I am working on figuring out what the estimation of such a project ...
0
votes
1answer
34 views

How to use different @Entity(“parameter”, expr=“repository.customQuery()”) with multiple routes

In my controller, I have multiple route set for one action. They all need same content, but are on différent URLs. One of the route have no parameters, while the second have 1 parameter. Thus, my ...
0
votes
0answers
48 views

One symfony form block is displayed by default, but I need zero blocks

I built a new form and by default there's one form-block displayed in the collection of blocks. I want to have zero form-blocks in this collection by default. What parameter is responsible for the ...
1
vote
2answers
74 views

How to handle exceptions using events in Symfony 4?

Right now I'm trying to catch an exception event like that: try { echo 1 / 0; } catch (\Exception $e){ $subs = new ExceptionSubscriber(); $this->dispatcher->addSubscriber($subs); }; ...
0
votes
0answers
23 views

API platform cannot post relationship id

I am quite new to API platform and currently, I am trying to map with entities. I have one entity called "User" entity and another one is called "Credit" entity. And their relationship with each other ...
0
votes
0answers
33 views

symfony4 doctrine database migration failed “could not find drive”

I am working with symfony4 on a database with ORM Doctrine. I use windows. First I created a class entity(make:entity). Migration step (php bin/console make:migration) does not work because of "An ...
0
votes
1answer
43 views

Symfony 4 - in_array with multi array

I've : AdminValidateurController.php on line 43: array:2 [▼ 0 => Validateur^ {#986 ▼ -id: 5 -ordre: 1 -validateur: User^ {#773 ▶} } 1 => Validateur^ {#988 ▼ -id: 6 -...
-2
votes
0answers
37 views

How to deploy a Symfony4 app on Heroku with Mercure [on hold]

Summary: I'm attempting to deploy a symfony4 app/api using the real-time push capabilities library Mercure onto heroku but can't get it to work. Background and what I've tried: Some background info ...
-2
votes
0answers
22 views

Symfony 4 - HTTPClient doesn't authenticate via auth token [on hold]

I'm using HTTPClient component to connect REST API. I think httpclient doesen't send authentication token, im always get unauthorized response. use Symfony\Contracts\HttpClient\HttpClientInterface; //...
1
vote
1answer
52 views

How to override Symfony's security for a specific environment?

I'm trying to configure Symfony's security component so that in a specific environment (travis) there is no security enabled for any endpoints. We'll be using the Cypress testing suite to perform ...
-2
votes
0answers
44 views

Check if user has logged in, and if yes, redirect to a page [on hold]

I've successfully implemented the login form, read through the security section of documents but I think I've missed something. What I want to achieve is that when a user has logged in to my site ...
-3
votes
0answers
11 views

How to fix \installer does not exist in symfony4 , make sure annotations are enbaled and installed [on hold]

I I have created a restful api ( a controller to get all movies in my database and an entity movie, when i compile this error come , how can i fix please [1]: https://i.stack.imgur.com/Zt6Eg.jpg
0
votes
0answers
8 views

Symfony passing variables to extended CustomType

Some other question, maybe im missing it @documentation. I'm playing around with CustomTypes, in detail with passing variables to the CustomType. My CustomType looks like this class ...
0
votes
1answer
22 views

Symfony4 pluralization on translation not working

Pluralization is working partially in Symfony4.3 when I use the new ICU Format for messages. Expected behaviour: One item found Current behaviour: {1, plural, =0 {No items found.} one {One item ...
0
votes
1answer
9 views

Relative path base_url for packages

I am trying to set packages for assets. Under my public directory I have css, js direactories. What I want to achieve is to use packages like: {{ asset('style.css', 'css') }} what needs to point ...
0
votes
0answers
36 views

Symfony 4 - Database connection refused

Symfony4 PHP 7.2.19 Ubuntu Linux 18.04.2 ( Up to date) MySQL 5.7.27 Its seems like I cannot get access to my database. I do have access to phpMyAdmin with the same user & password. I downloaded ...
-1
votes
1answer
27 views

Symfony user registration and add addresses

I want to create a Form to registration an user and his addresses (billing/shipping) My Form contain UserEntity and two Address(Billing/Shipping) In my User Entity, I want to save many addresses what ...
1
vote
0answers
28 views

Symfony failed to load some dependencies

I have a few problems loading use_cases in my project using symfony dependency injection. The following code belongs to RegisterUserController class. <?php namespace App\Infrastructure\...
0
votes
0answers
12 views

How to use SonataAdminBundle's ChoiceFieldMaskType as checkbox?

I'm trying to use a checkbox inside SonataAdminBundle's FormMapper, and depending on if the checkbox is checked or not, another input field should be shown or hidden. That's what ChoiceFieldMaskType ...
1
vote
1answer
34 views

Getting data from the database based on dropdown selection in Symfony forms

I have two Entities, First one is the Company Entity and the other one is Events Events Entity. ManyToOne(targetEntity="App\Entity\Company", inversedBy="events" On the events from I have created a ...
0
votes
0answers
27 views

I have an issue with an invalid identifier configuration in API Platform

So basically I'm creating a simple API to return a random quote based on the language field instead of the ID field for a Quote entity. I'm using Symfony 4 with the api-platform and tried to create a ...
2
votes
2answers
80 views

How can I configure basic authentication in Symfony to allow an empty password?

I am writing a REST API endpoint in PHP / Symfony 4.0 and I want to use basic authentication, with an in-memory user whose password is blank. When I try to call the endpoint with these credentials, I ...
0
votes
0answers
25 views

Symfony 4 - Delete Entity which have a OneToMany relation

I have two entities, the first on for the items and the second one for the tags. Every item could have just one tag but every tag could be used by several items. Now I want to delete a tag (and ...
-2
votes
1answer
46 views

How to generate right route in twig with dynamic sub-domain?

I have a multi-tenant APP based on sub-domain that's working properly but I have an issue with generated link in Twig templates. All the generated link are on the default sub-domain and not the ...