<?php
namespace App\Event\Order;
use App\Entity\Articles\Article;
use App\Entity\Articles\MouvementStock;
use App\Entity\GestionComerciale\Commande;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Contracts\EventDispatcher\Event;
class OrderMarketPlaceCreatedEvent extends Event
{
protected int $orderId;
private $output;
public function __construct($commande, OutputInterface $output = null)
{
if ($commande instanceof Commande) {
$this->orderId = $commande->getId();
} elseif (is_numeric($commande)) {
$this->orderId = (int) $commande;
} else {
throw new \InvalidArgumentException('Commande must be an instance of Commande or an integer');
}
$this->output = $output;
}
public function getOrderId(): int
{
return $this->orderId;
}
public function getOutput()
{
return $this->output;
}
}