[ManyToMany] bad datas inserting #10839
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
-
I founded and solved the problem I created UtilisateurGroupeController `
` `
` `
{{ form_label(form.utilisateurs) }}
{{ form_widget(form.utilisateurs) }}
{{ form_help(form.utilisateurs) }}
{{ form_errors(form.utilisateurs) }}
{{ form_label(form.groupes) }}
{{ form_widget(form.groupes) }}
{{ form_help(form.groupes) }}
{{ form_errors(form.groupes) }}
|
Beta Was this translation helpful? Give feedback.
-
Hello
Symfony version : 6.2.11
I don't understand why the new datas saved to the table utilisateur
Doctrine\Common\Collections\ArrayCollection@00000000000002b60000000000000000
but i see well the datas to the jointed table
the id 3749 is new data so it's wrong
utilisateur_id | groupe_id | 3749 | 1
Normally, the existing data should be saved as below
utilisateur_id | groupe_id | 1 | 1
I search where is the error
Can you help to me? I thanks to you to help.
Best regards
Gilles
Entity : Utilisateur
entity : Groupe
`<?php
namespace App\Entity;
use App\Repository\GroupeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: GroupeRepository::class)]
class Groupe
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
// return $this;
}
}`
Form : UtilisateurToGroupe
`<?php
// dump($builder);
}
Beta Was this translation helpful? Give feedback.
All reactions