<?phpnamespace App\Entity;use App\Repository\ModuleRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ModuleRepository::class)]#[ORM\Table(name: 'tb_modules')]#[ORM\HasLifecycleCallbacks]class Module{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: "integer", unique: true)] private ?int $id; #[ORM\Column(type: 'string', length: 50, nullable: false)] private ?string $code; #[ORM\Column(type: 'string', length: 50, nullable: false)] #[Assert\NotBlank(message: "Saisir un nom pour le module")] private ?string $name; #[ORM\Column(type: 'boolean', nullable: true)] private ?bool $activated; #[ORM\Column(type: 'datetime', nullable: false)] private \DateTimeInterface $createdAt; #[ORM\Column(type: 'datetime', nullable: false)] private ?\DateTimeInterface $modifiedAt; #[ORM\ManyToOne] private ?User $createdBy = null; public function __construct() { $this->createdAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getActivated(): ?bool { return $this->activated; } public function setActivated(?bool $activated): self { $this->activated = $activated; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getModifiedAt(): ?\DateTimeInterface { return $this->modifiedAt; } public function setModifiedAt(?\DateTimeInterface $modifiedAt): self { $this->modifiedAt = $modifiedAt; return $this; } /** * @ORM\PreUpdate */ public function onUpdate() { $this->modifiedAt = new \DateTime(); } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): static { $this->createdBy = $createdBy; return $this; }}