src/Entity/Customer/Customer.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Customer;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Sylius\Component\Core\Model\Customer as BaseCustomer;
  7. use Sylius\Component\Order\Model\OrderInterface;
  8. /**
  9.  * @ORM\Entity
  10.  * @ORM\Table(name="sylius_customer")
  11.  */
  12. class Customer extends BaseCustomer
  13. {
  14.     /**
  15.      * @return Collection|OrderInterface[]
  16.      * @psalm-var Collection<array-key, OrderInterface>
  17.      */
  18.     public function getOrders(): Collection
  19.     {
  20.         return $this->orders;
  21.     }
  22.     public function getStatusFilteredOrders($status): Collection
  23.     {
  24.         return $this->orders->filter(function(OrderInterface $order) use ($status) {
  25.             return $order->getState() == $status;
  26.         });
  27.     }
  28. }