mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix cs
This commit is contained in:
parent
2a5bb28210
commit
89a700ff61
@ -87,6 +87,13 @@ class DocumentCategory
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setBundleId($id): self
|
||||
{
|
||||
$this->bundleId = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDocumentClass($documentClass): self
|
||||
{
|
||||
$this->documentClass = $documentClass;
|
||||
@ -100,11 +107,4 @@ class DocumentCategory
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setBundleId($id): self
|
||||
{
|
||||
$this->bundleId = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ use Chill\MainBundle\Form\UserType;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
|
||||
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactoryInterface;
|
||||
use LogicException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
@ -39,7 +37,6 @@ class UserController extends CRUDController
|
||||
{
|
||||
public const FORM_GROUP_CENTER_COMPOSED = 'composed_groupcenter';
|
||||
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private UserPasswordEncoderInterface $passwordEncoder;
|
||||
@ -48,7 +45,6 @@ class UserController extends CRUDController
|
||||
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $chillLogger,
|
||||
ValidatorInterface $validator,
|
||||
@ -61,42 +57,6 @@ class UserController extends CRUDController
|
||||
$this->passwordEncoder = $passwordEncoder;
|
||||
}
|
||||
|
||||
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
|
||||
{
|
||||
if (!$filterOrder instanceof FilterOrderHelper) {
|
||||
return parent::countEntities($action, $request, $filterOrder);
|
||||
}
|
||||
|
||||
if (null === $filterOrder->getQueryString()) {
|
||||
return parent::countEntities($action, $request, $filterOrder);
|
||||
}
|
||||
|
||||
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
|
||||
}
|
||||
|
||||
protected function getQueryResult(
|
||||
string $action,
|
||||
Request $request,
|
||||
int $totalItems,
|
||||
PaginatorInterface $paginator,
|
||||
?FilterOrderHelper $filterOrder = null
|
||||
) {
|
||||
if (0 === $totalItems) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!$filterOrder instanceof FilterOrderHelper) {
|
||||
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
|
||||
}
|
||||
|
||||
if (null === $filterOrder->getQueryString()) {
|
||||
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
|
||||
}
|
||||
|
||||
return $this->userRepository->findByUsernameOrEmail($filterOrder->getQueryString(), ['usernameCanonical' => 'ASC'],
|
||||
$paginator->getItemsPerPage(), $paginator->getCurrentPageFirstItemNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/admin/main/user/{uid}/add_link_groupcenter",
|
||||
* name="admin_user_add_groupcenter")
|
||||
@ -269,6 +229,19 @@ class UserController extends CRUDController
|
||||
->build();
|
||||
}
|
||||
|
||||
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
|
||||
{
|
||||
if (!$filterOrder instanceof FilterOrderHelper) {
|
||||
return parent::countEntities($action, $request, $filterOrder);
|
||||
}
|
||||
|
||||
if (null === $filterOrder->getQueryString()) {
|
||||
return parent::countEntities($action, $request, $filterOrder);
|
||||
}
|
||||
|
||||
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
|
||||
}
|
||||
|
||||
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
|
||||
{
|
||||
// for "new", add special config
|
||||
@ -304,6 +277,33 @@ class UserController extends CRUDController
|
||||
return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters);
|
||||
}
|
||||
|
||||
protected function getQueryResult(
|
||||
string $action,
|
||||
Request $request,
|
||||
int $totalItems,
|
||||
PaginatorInterface $paginator,
|
||||
?FilterOrderHelper $filterOrder = null
|
||||
) {
|
||||
if (0 === $totalItems) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!$filterOrder instanceof FilterOrderHelper) {
|
||||
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
|
||||
}
|
||||
|
||||
if (null === $filterOrder->getQueryString()) {
|
||||
return parent::getQueryResult($action, $request, $totalItems, $paginator, $filterOrder);
|
||||
}
|
||||
|
||||
return $this->userRepository->findByUsernameOrEmail(
|
||||
$filterOrder->getQueryString(),
|
||||
['usernameCanonical' => 'ASC'],
|
||||
$paginator->getItemsPerPage(),
|
||||
$paginator->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
}
|
||||
|
||||
protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request)
|
||||
{
|
||||
// for "new", encode the password
|
||||
|
@ -186,7 +186,6 @@ final class UserRepository implements ObjectRepository
|
||||
->add($qb->expr()->like('u.usernameCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'))
|
||||
->add($qb->expr()->like('u.emailCanonical', 'CONCAT(\'%\', LOWER(UNACCENT(:pattern)), \'%\')'));
|
||||
|
||||
|
||||
$qb
|
||||
->where($searchByPattern)
|
||||
->setParameter('pattern', $pattern);
|
||||
|
Loading…
x
Reference in New Issue
Block a user