Category : arrays

I’ve followed the documentation of the symfony’s bundle oneup_uploader for uploading file to a specific endpoint. It work well, but when i try to send a response on my listener, like an url and when i try to add field ‘url’ in my response, it return me an url like that: url/someurl instead of url/someurl. ..

Read more

I want to add product to my session array but always it overwriting existing product and is only one. /** * @Route("/{id}", name="add", methods={"GET"}) */ public function add(Product $product, Request $request): Response { $session= $request->getSession(); $session->set(‘products’, array( ‘list’ => $product, )); $this->addFlash(‘success’, ‘add’); return $this->render(‘index.html.twig’, [ ‘product’ => $product ]); } any suggestion? Source: Symfony ..

Read more

$array = $this->em->getRepository($entity)->filter($id); With doctrine I am creating an array: array:24 [▼ 0 => Members^ {#543 ▼ -id: 1 -username: "lio" -email: "[email protected]" -isActive: true -name: "Lio" -projects: PersistentCollection^ {#590 ▶} -pages: PersistentCollection^ {#615 ▶} } 1 => Members^ {#135029 ▶} 2 => Members^ {#125937 ▶} 3 => Members^ {#1807 ▶} 4 => Members^ {#135075 ..

Read more

I need to compare my two tables to know if they are empty and if so, not includ them in the result. I have the following code : public function parseJson() { foreach ($this->vendors as $row) { if ($row->legIntPurposes === $row->flexiblePurposes) { $this->results[] = [ ‘id’ => $row->id, ‘name’ => $row->name, ‘policyUrl’ => $row->policyUrl, ]; ..

Read more

here is what i’ve put in my Symfony session $this->session->set(‘teams’, [ ‘team_1’ => [‘MyTeamNameA’ => [‘player-1’ => $safe[‘team-1-player-1’], ‘player-2’ => $safe[‘team-1-player-2’], ‘player-3’ => $safe[‘team-1-player-3’], ‘player-4’ => $safe[‘team-1-player-4’], ‘points’ => 0]], ‘team_2’ => [‘MyTeamNameB’ => [‘player-1’ => $safe[‘team-2-player-1’], ‘player-2’ => $safe[‘team-2-player-2’], ‘player-3’ => $safe[‘team-2-player-3’], ‘player-4’ => $safe[‘team-2-player-4’], ‘points’ => 0]], ]); And now, in my twig, ..

Read more

Here is what I put in my Symfony session $this->session->set(‘teams’, [ ‘team_1’ => [‘MyTeamNameA’ => [‘player-1’ => $safe[‘team-1-player-1’], ‘player-2’ => $safe[‘team-1-player-2’], ‘player-3’ => $safe[‘team-1-player-3’], ‘player-4’ => $safe[‘team-1-player-4’], ‘points’ => 0]], ‘team_2’ => [‘MyTeamNameB’ => [‘player-1’ => $safe[‘team-2-player-1’], ‘player-2’ => $safe[‘team-2-player-2’], ‘player-3’ => $safe[‘team-2-player-3’], ‘player-4’ => $safe[‘team-2-player-4’], ‘points’ => 0]], ]); And now, in my Twig, ..

Read more

I’ve problem with Collectiontype in Symfony 4. I try to save some informations in many table on database. My saving cascade is: 1 releve contains 1 carriere contains lots of infoCarriere contains lots of points To save this information, i use a specific form with collectionType: My CarriereRelaiType: public function buildForm(FormBuilderInterface $builder, array $options) { ..

Read more