- Ajout Entity Avis
- Déplacement js dans le dossier public
This commit is contained in:
@ -66,6 +66,7 @@ class RegistrationController extends AbstractController
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Votre compte a été créé avec succès !');
|
||||
|
||||
return $this->redirectToRoute('home');
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,13 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Favoris::class)]
|
||||
private Collection $favoris;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'id_user', targetEntity: Avis::class)]
|
||||
private Collection $avis;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->favoris = new ArrayCollection();
|
||||
$this->avis = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
@ -169,4 +173,34 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Avis>
|
||||
*/
|
||||
public function getAvis(): Collection
|
||||
{
|
||||
return $this->avis;
|
||||
}
|
||||
|
||||
public function addAvi(Avis $avi): static
|
||||
{
|
||||
if (!$this->avis->contains($avi)) {
|
||||
$this->avis->add($avi);
|
||||
$avi->setIdUser($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAvi(Avis $avi): static
|
||||
{
|
||||
if ($this->avis->removeElement($avi)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($avi->getIdUser() === $this) {
|
||||
$avi->setIdUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user