<?php

namespace common\logic\Order\ProductOrder\Repository;

use common\logic\AbstractRepositoryQuery;
use common\logic\Order\Order\Model\Order;
use common\logic\Order\ProductOrder\Model\ProductOrder;
use common\logic\Order\ProductOrder\Service\ProductOrderDefinition;
use yii\db\ActiveQuery;

class ProductOrderRepositoryQuery extends AbstractRepositoryQuery
{
    protected ProductOrderDefinition $definition;

    public function loadDependencies(): void
    {
        $this->loadDefinition(ProductOrderDefinition::class);
    }

    public function filterByOrder(Order $order): self
    {
        $this->andWhere(['id_order' => $order->id]);

        return $this;
    }
}