<?php

namespace apexl\Io\modules\subscription\entities\operators;

use apexl\Io\operators\entityDatabaseOperator;

class subscriptionCreditOperator extends entityDatabaseOperator{

    public function __construct($table, $primaryKey = 'id')
    {
        parent::__construct($table, $primaryKey);
    }

    public function getForSubscription($subscriptionId, $startDate, $endDate){
        return $this->vault->select('subscription_credit')
            ->fields()
            ->where('subscription_id', $subscriptionId)
            ->where('credit_date', $startDate, '>=')
            ->where('credit_date', $endDate, '<=')
            ->execute()
            ->fetchAll();
    }
   
}