src/Entity/Notification.php line 32
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\GetCollection;use ApiPlatform\Metadata\Post;use ApiPlatform\Metadata\Put;use ApiPlatform\Metadata\Patch;use App\Repository\NotificationRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;use ApiPlatform\Metadata\ApiFilter;#[ORM\Entity(repositoryClass: NotificationRepository::class)]#[ApiResource(normalizationContext: ['groups' => ['read:notification']],denormalizationContext: ['groups' => ['write:notification']],operations: [new Get(),new GetCollection(),new Post(),new Put(),new Patch(),],paginationEnabled: true,paginationItemsPerPage: 50),ApiFilter(SearchFilter::class, properties: ['user' => 'exact', 'lu' => 'exact'])]class Notification{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['read:notification', 'write:notification'])]private ?int $id = null;#[ORM\ManyToOne(targetEntity: User::class)]#[ORM\JoinColumn(nullable: false)]#[Groups(['read:notification', 'write:notification'])]private ?User $user = null;#[ORM\Column(length: 255)]#[Groups(['read:notification', 'write:notification'])]private ?string $titre = null;#[ORM\Column(type: 'text')]#[Groups(['read:notification', 'write:notification'])]private ?string $message = null;#[ORM\Column(type: 'boolean')]#[Groups(['read:notification', 'write:notification'])]private ?bool $lu = false;#[ORM\Column(type: 'datetime')]#[Groups(['read:notification', 'write:notification'])]private ?\DateTimeInterface $dateCreation = null;#[ORM\Column(length: 50, nullable: true)]#[Groups(['read:notification', 'write:notification'])]private ?string $type = null; // 'bienvenue', 'achat', 'preuve_soumise'public function __construct(){$this->dateCreation = new \DateTime();$this->lu = false;}public function getId(): ?int{return $this->id;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}public function getTitre(): ?string{return $this->titre;}public function setTitre(string $titre): self{$this->titre = $titre;return $this;}public function getMessage(): ?string{return $this->message;}public function setMessage(string $message): self{$this->message = $message;return $this;}public function isLu(): bool{return $this->lu ?? false;}public function getLu(): bool{return $this->lu ?? false;}public function setLu(bool $lu): self{$this->lu = $lu;return $this;}public function getDateCreation(): ?\DateTimeInterface{return $this->dateCreation;}public function setDateCreation(\DateTimeInterface $dateCreation): self{$this->dateCreation = $dateCreation;return $this;}public function getType(): ?string{return $this->type;}public function setType(?string $type): self{$this->type = $type;return $this;}}