src/Event/Order/OrderMarketPlaceCreatedEvent.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Event\Order;
  3. use App\Entity\Articles\Article;
  4. use App\Entity\Articles\MouvementStock;
  5. use App\Entity\GestionComerciale\Commande;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. use Symfony\Contracts\EventDispatcher\Event;
  8. class OrderMarketPlaceCreatedEvent extends Event
  9. {
  10.     protected int $orderId;
  11.     private $output;
  12.     public function __construct($commandeOutputInterface $output null)
  13.     {
  14.         if ($commande instanceof Commande) {
  15.             $this->orderId $commande->getId();
  16.         } elseif (is_numeric($commande)) {
  17.             $this->orderId = (int) $commande;
  18.         } else {
  19.             throw new \InvalidArgumentException('Commande must be an instance of Commande or an integer');
  20.         }
  21.         $this->output $output;
  22.     }
  23.     public function getOrderId(): int
  24.     {
  25.         return $this->orderId;
  26.     }
  27.     public function getOutput()
  28.     {
  29.         return $this->output;
  30.     }
  31. }