admin: refine social work admin form

This commit is contained in:
nobohan
2022-05-10 18:06:29 +02:00
parent b7ed658f96
commit f449dcbda1
10 changed files with 178 additions and 3 deletions

View File

@@ -19,8 +19,11 @@ use Chill\MainBundle\Form\UserCurrentLocationType;
use Chill\MainBundle\Form\UserPasswordType;
use Chill\MainBundle\Form\UserType;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
use Psr\Log\LoggerInterface;
use RuntimeException;
use LogicException;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
@@ -41,14 +44,57 @@ class UserController extends CRUDController
private ValidatorInterface $validator;
private FilterOrderHelperFactoryInterface $filterOrderHelperFactory;
public function __construct(
LoggerInterface $chillLogger,
ValidatorInterface $validator,
UserPasswordEncoderInterface $passwordEncoder
UserPasswordEncoderInterface $passwordEncoder,
FilterOrderHelperFactoryInterface $filterOrderHelperFactory
) {
$this->logger = $chillLogger;
$this->validator = $validator;
$this->passwordEncoder = $passwordEncoder;
$this->filterOrderHelperFactory = $filterOrderHelperFactory;
}
// public function index(Request $request)
// {
// dump($request);
// //$filterOrder = $this->buildFilterOrderHelper('index', $request);
// return parent::indexEntityAction('index', $request);
// }
// protected function buildFilterOrderHelper($action, $request): FilterOrderHelper
// {
// $filter_order = $this->filterOrderHelperFactory
// ->create(self::class)
// ->addSearchBox(['name'])
// ->build();
// dump($filter_order);
// return $filter_order;
// }
protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper
{
return $this->getFilterOrderHelperFactory()
->create(self::class)
->addSearchBox(['label'])
->build();
}
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
{
if (null === $filterOrder) {
throw new LogicException('filterOrder should not be null');
}
dump($filterOrder);
$count = parent::countEntities($action, $request, $filterOrder);
dump($count);
return $count;
}
/**