<?php

namespace KupShop\I18nBundle\Admin\lists;

use Doctrine\DBAL\Query\QueryBuilder;
use KupShop\I18nBundle\Translations\DeliveryTypeDeliveriesTranslation;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;

class TranslateDeliveryTypeDeliveriesList extends TranslateList
{
    protected $template = 'list/translateDeliveryTypeDeliveries.tpl';

    protected $listType = 'translateDeliveryTypeDeliveries';

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

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

        $qb->addSelect('COALESCE(dtd.name_admin, dtd.name) as name');

        return $qb;
    }
}

$main_class = TranslateDeliveryTypeDeliveriesList::class;
