<commit_before><?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\CouponBundle\DataSet\Admin;

use Doctrine\ORM\QueryBuilder;
use WellCommerce\Bundle\CoreBundle\DataSet\AbstractDataSet;
use WellCommerce\Component\DataSet\Configurator\DataSetConfiguratorInterface;

/**
 * Class CouponDataSet
 *
 * @author <NAME> <<EMAIL>>
 */
class CouponDataSet extends AbstractDataSet
{
    /**
     * {@inheritdoc}
     */
    public function configureOptions(DataSetConfiguratorInterface $configurator)
    {
        $configurator->setColumns([
            'id'                => 'coupon.id',
            'name'              => 'coupon_translation.name',
            'code'              => 'coupon.code',
            'createdAt'         => 'coupon.createdAt',
            'validFrom'         => 'coupon.validFrom',
            'validTo'           => 'coupon.validTo',
            'currency'          => 'coupon.currency',
            'minimumOrderValue' => 'coupon.minimumOrderValue',
            'discount'          => 'IF_ELSE(coupon.modifierType = \'%\', CONCAT_WS(\'\', coupon.modifierValue, coupon.modifierType), CONCAT_WS(\' \', coupon.modifierValue, coupon.currency))',
        ]);
        
        $configurator->setColumnTransformers([
            'createdAt' => $this->getDataSetTransformer('date', ['format' => 'Y-m-d H:i:s']),
            'validFrom' => $this->getDataSetTransformer('date', ['format' => 'Y-m-d']),
            'validTo'   => $this->getDataSetTransformer('date', ['format' => 'Y-m-d']),
        ]);
    }
    
    protected function createQueryBuilder(): QueryBuilder
    {
        $queryBuilder = $this->repository->getQueryBuilder();
        $queryBuilder->groupBy('coupon.id');
        $queryBuilder->leftJoin('coupon.translations', 'coupon_translation');
        
        return $queryBuilder;
    }
}<commit_msg>Removed deprectaed dataset classes, simplified dataset's usage<commit_after><?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\CouponBundle\DataSet\Admin;

use Doctrine\ORM\QueryBuilder;
use WellCommerce\Bundle\CoreBundle\DataSet\AbstractDataSet;
use WellCommerce\Component\DataSet\Configurator\DataSetConfiguratorInterface;

/**
 * Class CouponDataSet
 *
 * @author <NAME> <<EMAIL>>
 */
class CouponDataSet extends AbstractDataSet
{
    /**
     * {@inheritdoc}
     */
    public function configureOptions(DataSetConfiguratorInterface $configurator)
    {
        $configurator->setColumns([
            'id'                => 'coupon.id',
            'name'              => 'coupon_translation.name',
            'code'              => 'coupon.code',
            'createdAt'         => 'coupon.createdAt',
            'validFrom'         => 'coupon.validFrom',
            'validTo'           => 'coupon.validTo',
            'currency'          => 'coupon.currency',
            'minimumOrderValue' => 'coupon.minimumOrderValue',
            'discount'          => 'IF_ELSE(coupon.modifierType = \'%\', CONCAT_WS(\'\', coupon.modifierValue, coupon.modifierType), CONCAT_WS(\' \', coupon.modifierValue, coupon.currency))',
        ]);
        
        $configurator->setColumnTransformers([
            'createdAt' => $this->manager->createTransformer('date', ['format' => 'Y-m-d H:i:s']),
            'validFrom' => $this->manager->createTransformer('date', ['format' => 'Y-m-d']),
            'validTo'   => $this->manager->createTransformer('date', ['format' => 'Y-m-d']),
        ]);
    }
    
    protected function createQueryBuilder(): QueryBuilder
    {
        $queryBuilder = $this->repository->getQueryBuilder();
        $queryBuilder->groupBy('coupon.id');
        $queryBuilder->leftJoin('coupon.translations', 'coupon_translation');
        
        return $queryBuilder;
    }
}
{'fraction_non_alphanumeric': 0.14650283553875237, 'fraction_numerical': 0.0, 'mean_word_length': 2.5994897959183674, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 66, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4602172', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1259, 'n_words': 220}