mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 21:13:57 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -19,7 +19,6 @@ use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -28,8 +27,6 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_merge;
|
||||
|
||||
final class ThirdPartyController extends CRUDController
|
||||
{
|
||||
private readonly bool $askCenter;
|
||||
@@ -57,15 +54,15 @@ final class ThirdPartyController extends CRUDController
|
||||
return $this->getFilterOrderHelperFactory()
|
||||
->create(self::class)
|
||||
->addSearchBox(['name', 'company_name', 'acronym'])
|
||||
//->addToggle('only-active', [])
|
||||
// ->addToggle('only-active', [])
|
||||
// ->addOrderBy()
|
||||
->build();
|
||||
}
|
||||
|
||||
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
|
||||
protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int
|
||||
{
|
||||
if (null === $filterOrder) {
|
||||
throw new LogicException('filterOrder should not be null');
|
||||
throw new \LogicException('filterOrder should not be null');
|
||||
}
|
||||
|
||||
return $this->thirdPartyACLAwareRepository->countThirdParties(
|
||||
@@ -74,17 +71,17 @@ final class ThirdPartyController extends CRUDController
|
||||
);
|
||||
}
|
||||
|
||||
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
|
||||
protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface
|
||||
{
|
||||
if ('new' === $action) {
|
||||
return parent::createFormFor($action, $entity, $formClass, array_merge(
|
||||
return parent::createFormFor($action, $entity, $formClass, \array_merge(
|
||||
$formOptions,
|
||||
['kind' => $this->requestStack->getCurrentRequest()->query->getAlpha('kind')]
|
||||
));
|
||||
}
|
||||
|
||||
if ('edit' === $action) {
|
||||
return parent::createFormFor($action, $entity, $formClass, array_merge(
|
||||
return parent::createFormFor($action, $entity, $formClass, \array_merge(
|
||||
$formOptions,
|
||||
['kind' => $entity->getKind()]
|
||||
));
|
||||
@@ -93,7 +90,7 @@ final class ThirdPartyController extends CRUDController
|
||||
return parent::createFormFor($action, $entity, $formClass, $formOptions);
|
||||
}
|
||||
|
||||
protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, ?FilterOrderHelper $filterOrder = null)
|
||||
protected function getQueryResult(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, FilterOrderHelper $filterOrder = null)
|
||||
{
|
||||
return $this->thirdPartyACLAwareRepository
|
||||
->listThirdParties(
|
||||
@@ -120,7 +117,7 @@ final class ThirdPartyController extends CRUDController
|
||||
$kind = $request->query->getAlpha('kind', '');
|
||||
|
||||
if (!(ThirdParty::KIND_COMPANY === $kind || ThirdParty::KIND_CONTACT === $kind)) {
|
||||
throw new BadRequestHttpException('This kind is not supported: ' . $kind);
|
||||
throw new BadRequestHttpException('This kind is not supported: '.$kind);
|
||||
}
|
||||
|
||||
$entity->setKind($kind);
|
||||
@@ -130,7 +127,6 @@ final class ThirdPartyController extends CRUDController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $action
|
||||
* @param ThirdParty $entity
|
||||
*/
|
||||
protected function onPostFetchEntity($action, Request $request, $entity): ?Response
|
||||
|
Reference in New Issue
Block a user