<?php

namespace KupShop\I18nBundle\Admin\lists;

use Doctrine\DBAL\Query\QueryBuilder;
use KupShop\CatalogBundle\Util\ReviewsUtil;
use KupShop\I18nBundle\Translations\ReviewsTranslation;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
use Query\Operator;

class TranslateReviewsList extends TranslateList
{
    protected $template = 'list/translateReviews.tpl';

    protected $listType = 'translateReviews';

    public function __construct()
    {
        parent::__construct();
        $this->translation = ServiceContainer::getService(ReviewsTranslation::class);
    }

    protected function applyFilters(QueryBuilder $qb)
    {
        $qb = parent::applyFilters($qb);

        $qb->andWhere(Operator::not(Operator::equals(['r.figure' => ReviewsUtil::RANK_DECLINED])));

        return $qb;
    }
}

$main_class = TranslateReviewsList::class;
