mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 01:53:49 +00:00
Merge branch 'master' into upgrade-sf5
This commit is contained in:
@@ -59,7 +59,7 @@ final class ThirdPartyController extends CRUDController
|
||||
->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');
|
||||
@@ -71,7 +71,7 @@ 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(
|
||||
@@ -90,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(
|
||||
|
@@ -655,7 +655,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
throw new \UnexpectedValueException(sprintf('typeAndCategory should be a string or a %s', ThirdPartyCategory::class));
|
||||
}
|
||||
|
||||
public function setAcronym(string $acronym = null): ThirdParty
|
||||
public function setAcronym(?string $acronym = null): ThirdParty
|
||||
{
|
||||
$this->acronym = (string) $acronym;
|
||||
|
||||
@@ -679,7 +679,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setAddress(Address $address = null)
|
||||
public function setAddress(?Address $address = null)
|
||||
{
|
||||
$this->address = $address;
|
||||
|
||||
@@ -716,7 +716,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
*
|
||||
* @return ThirdParty
|
||||
*/
|
||||
public function setComment(string $comment = null)
|
||||
public function setComment(?string $comment = null)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
@@ -754,7 +754,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
*
|
||||
* @return ThirdParty
|
||||
*/
|
||||
public function setEmail(string $email = null)
|
||||
public function setEmail(?string $email = null)
|
||||
{
|
||||
$this->email = trim((string) $email);
|
||||
|
||||
@@ -806,7 +806,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
|
||||
/**
|
||||
* Set telephone.
|
||||
*/
|
||||
public function setTelephone(PhoneNumber $telephone = null): self
|
||||
public function setTelephone(?PhoneNumber $telephone = null): self
|
||||
{
|
||||
$this->telephone = $telephone;
|
||||
|
||||
|
@@ -16,7 +16,9 @@ use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
|
||||
class LabelThirdPartyHelper
|
||||
{
|
||||
public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository) {}
|
||||
public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly ThirdPartyRepository $thirdPartyRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function getLabel(string $key, array $values, string $header): callable
|
||||
{
|
||||
|
@@ -24,7 +24,9 @@ class PickThirdPartyTypeCategoryType extends \Symfony\Component\Form\AbstractTyp
|
||||
{
|
||||
private const PREFIX_TYPE = 'chill_3party.key_label.';
|
||||
|
||||
public function __construct(private readonly ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private readonly ThirdPartyTypeManager $thirdPartyTypeManager, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) {}
|
||||
public function __construct(private readonly ThirdPartyCategoryRepository $thirdPartyCategoryRepository, private readonly ThirdPartyTypeManager $thirdPartyTypeManager, private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
|
@@ -26,7 +26,9 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
*/
|
||||
class PickThirdpartyDynamicType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer) {}
|
||||
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly SerializerInterface $serializer, private readonly NormalizerInterface $normalizer)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@@ -39,6 +41,8 @@ class PickThirdpartyDynamicType extends AbstractType
|
||||
$view->vars['types'] = ['thirdparty'];
|
||||
$view->vars['uniqid'] = uniqid('pick_user_dyn');
|
||||
$view->vars['suggested'] = [];
|
||||
$view->vars['as_id'] = true === $options['as_id'] ? '1' : '0';
|
||||
$view->vars['submit_on_adding_new_entity'] = true === $options['submit_on_adding_new_entity'] ? '1' : '0';
|
||||
|
||||
foreach ($options['suggested'] as $tp) {
|
||||
$view->vars['suggested'][] = $this->normalizer->normalize($tp, 'json', ['groups' => 'read']);
|
||||
@@ -51,7 +55,11 @@ class PickThirdpartyDynamicType extends AbstractType
|
||||
->setDefault('multiple', false)
|
||||
->setAllowedTypes('multiple', ['bool'])
|
||||
->setDefault('compound', false)
|
||||
->setDefault('suggested', []);
|
||||
->setDefault('suggested', [])
|
||||
->setDefault('as_id', false)
|
||||
->setAllowedTypes('as_id', ['bool'])
|
||||
->setDefault('submit_on_adding_new_entity', false)
|
||||
->setAllowedTypes('submit_on_adding_new_entity', ['bool']);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
|
@@ -17,9 +17,11 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepositoryInterface
|
||||
{
|
||||
public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository) {}
|
||||
public function __construct(private Security $security, private AuthorizationHelper $authorizationHelper, private ThirdPartyRepository $thirdPartyRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function buildQuery(string $filterString = null): QueryBuilder
|
||||
public function buildQuery(?string $filterString = null): QueryBuilder
|
||||
{
|
||||
$qb = $this->thirdPartyRepository->createQueryBuilder('tp');
|
||||
|
||||
@@ -51,8 +53,8 @@ final readonly class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareR
|
||||
string $role,
|
||||
?string $filterString,
|
||||
?array $orderBy = [],
|
||||
int $limit = null,
|
||||
int $offset = null
|
||||
?int $limit = null,
|
||||
?int $offset = null
|
||||
): array {
|
||||
$qb = $this->buildQuery($filterString);
|
||||
|
||||
|
@@ -38,7 +38,7 @@ class ThirdPartyRepository implements ObjectRepository
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder
|
||||
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
|
||||
{
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class ThirdPartyRepository implements ObjectRepository
|
||||
*
|
||||
* @return array|ThirdParty[]
|
||||
*/
|
||||
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
@@ -44,14 +44,18 @@ FROM rows, searches
|
||||
*/
|
||||
class ThirdPartyApiSearch implements SearchApiInterface
|
||||
{
|
||||
public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository) {}
|
||||
public function __construct(private readonly ThirdPartyRepository $thirdPartyRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function getResult(string $key, array $metadata, float $pertinence)
|
||||
{
|
||||
return $this->thirdPartyRepository->find($metadata['id']);
|
||||
}
|
||||
|
||||
public function prepare(array $metadatas): void {}
|
||||
public function prepare(array $metadatas): void
|
||||
{
|
||||
}
|
||||
|
||||
public function provideQuery(string $pattern, array $parameters): SearchApiQuery
|
||||
{
|
||||
|
@@ -24,7 +24,9 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
public function __construct(private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function normalize($thirdParty, $format = null, array $context = [])
|
||||
{
|
||||
|
@@ -23,7 +23,9 @@ class ThirdPartyRender implements ChillEntityRenderInterface
|
||||
{
|
||||
use BoxUtilsChillEntityRenderTrait;
|
||||
|
||||
public function __construct(protected \Twig\Environment $engine, protected TranslatableStringHelper $translatableStringHelper) {}
|
||||
public function __construct(protected \Twig\Environment $engine, protected TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public function renderBox($entity, array $options): string
|
||||
{
|
||||
|
Reference in New Issue
Block a user