<?php
/*
* Plugin Name : CustomerRank
*
* Copyright (C) BraTech Co., Ltd. All Rights Reserved.
* http://www.bratech.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\CustomerRank42\Form\Extension;
use Doctrine\ORM\EntityRepository;
use Eccube\Form\Type\Admin\CustomerType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
class AdminCustomerExtension extends AbstractTypeExtension
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'CustomerRank',
EntityType::class,
[
'label' => trans('customerrank.common.rank'),
'class' => 'Plugin\CustomerRank42\Entity\CustomerRank',
'multiple' => false,
'expanded' => false,
'required' => false,
'placeholder' => trans('customerrank.admin.common.nothing'),
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('cr')
->orderBy('cr.priority', 'DESC');
},
]
);
}
public static function getExtendedTypes(): iterable
{
return [CustomerType::class];
}
}