Category : symfony

I have a symfony app in which I need to send an email asynchronously. When my users perform certain action I need to send an email to the admin. For that I’ve created a symfony custom command to use with Symfony Process Component, which is similar to php native’s exec(). My code is as follows: ..

Read more

This was working fine hours ago, I get data from database and simply display it in a table in Twig. This is the controller from where I get the instance of the variable having my entity "Cours" /** * @Route("/listeCours", name="liste_cours") */ public function index() { $lstCours = $this->getDoctrine() ->getRepository(‘App:Cours’) ->findAll(); return $this->render(‘liste_cours/index.html.twig’, [‘lstCours’ => ..

Read more

I’m testing a form in my website but I came across this issue which is mainly caused by the entity manager. This is the error IndexBundleTestsControllerCompanyControllerTest::testCompany DoctrineORMORMInvalidArgumentException: Entity [email protected] is not managed. An entity is managed if its fetched from the database or registered as new through EntityManager#persist This is my test <?php class CompanyControllerTest ..

Read more

I ‘m working with Symfony 5.1 using the firewall and a guard authenticator; secured_area: pattern: ^/ stateless: true provider: chain_provider guard: authenticators: – App<pathToAuthenticator> entry_point: App<pathToAuthenticator> All was working fine with 5.1. I’ve recently upgrade to Symfony 5.2 and almost all working fine except Unit tests. When i do a step by step debugging, it’s ..

Read more

I’m unable to read gzip encoded response in a Symfony projet. Here is my service : <?php namespace AppService; use SymfonyContractsHttpClientHttpClientInterface; class myApi { private $client; public function __construct(HttpClientInterface $client) { $this->client = $client; } public function getApiContent(){ $headers = [ ‘Accept: application/json’, ‘Accept-Encoding: gzip’, ‘Content-Type: application/json’, ]; $response = $this->client->request(‘GET’, ‘https://www.google.com’, [ ‘headers’ => ..

Read more

I’m making a JSON REST API using Symfony 5.2. One of the API calls returns a date, however I noticed the date is always serialized as an empty array ([]). Here is an extract from the response I get: {"count":1,"data":[{"id": 6, "published_from":[],"published_until":[]}]} The other fields like id are correct, but the dates aren’t. In the ..

Read more