<?php

namespace common\logic\Subscription\ProductSubscription\Repository;

use common\logic\AbstractRepositoryQuery;
use common\logic\Subscription\ProductSubscription\Service\ProductSubscriptionDefinition;
use common\logic\Subscription\Subscription\Model\Subscription;
use yii\db\ActiveQuery;

class ProductSubscriptionRepositoryQuery extends AbstractRepositoryQuery
{
    protected ProductSubscriptionDefinition $definition;

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

    public function filterBySubscription(Subscription $subscription): self
    {
        $this->andWhere(['id_subscription' => $subscription->id]);
        return $this;
    }
}