<?php
namespace App\Entity;
use App\Repository\CommandeActionsRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandeActionsRepository::class)]
class CommandeActions
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $action = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $date = null;
#[ORM\ManyToOne(inversedBy: 'commandeActions')]
private ?Commande $commande = null;
public function __construct()
{
$this->date = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(string $action): self
{
$this->action = $action;
return $this;
}
public function getCommande(): ?Commande
{
return $this->commande;
}
public function setCommande(?Commande $commande): self
{
$this->commande = $commande;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return ($this->date) ? $this->date : new \DateTime();
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getLocalizedDate(): string
{
setlocale(LC_ALL, 'fr_FR.utf8');
return strftime('%A %d %B %Y', $this->getDate()->getTimestamp());
}
public function __toString(): string
{
// TODO: Implement __toString() method.
return $this->getAction();
}
}