src/Entity/CommandeActions.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommandeActionsRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassCommandeActionsRepository::class)]
  7. class CommandeActions
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $action null;
  15.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  16.     private ?\DateTimeInterface $date null;
  17.     #[ORM\ManyToOne(inversedBy'commandeActions')]
  18.     private ?Commande $commande null;
  19.     public function __construct()
  20.     {
  21.         $this->date = new \DateTime();
  22.     }
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getAction(): ?string
  28.     {
  29.         return $this->action;
  30.     }
  31.     public function setAction(string $action): self
  32.     {
  33.         $this->action $action;
  34.         return $this;
  35.     }
  36.     public function getCommande(): ?Commande
  37.     {
  38.         return $this->commande;
  39.     }
  40.     public function setCommande(?Commande $commande): self
  41.     {
  42.         $this->commande $commande;
  43.         return $this;
  44.     }
  45.     public function getDate(): ?\DateTimeInterface
  46.     {
  47.         return ($this->date) ? $this->date : new \DateTime();
  48.     }
  49.     public function setDate(?\DateTimeInterface $date): self
  50.     {
  51.         $this->date $date;
  52.         return $this;
  53.     }
  54.     public function getLocalizedDate(): string
  55.     {
  56.         setlocale(LC_ALL'fr_FR.utf8');
  57.         return strftime('%A %d %B %Y'$this->getDate()->getTimestamp());
  58.     }
  59.     public function __toString(): string
  60.     {
  61.         // TODO: Implement __toString() method.
  62.         return $this->getAction();
  63.     }
  64. }