mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 07:33:50 +00:00
Merge branch 'upgrade-sf5' into signature-app-master
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Command;
|
||||
|
||||
use Chill\MainBundle\Service\Import\AddressReferenceLU;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadAddressesLUFromBDAddressCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Import LUX addresses from BD addresses (see https://data.public.lu/fr/datasets/adresses-georeferencees-bd-adresses/)';
|
||||
|
||||
public function __construct(
|
||||
private readonly AddressReferenceLU $addressImporter,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('chill:main:address-ref-lux');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->addressImporter->import();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
@@ -151,7 +151,7 @@ final class PermissionsGroupController extends AbstractController
|
||||
/**
|
||||
* remove an association between permissionsGroup and roleScope.
|
||||
*/
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['DELETE'])]
|
||||
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['POST'])]
|
||||
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
|
||||
{
|
||||
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
|
||||
|
@@ -92,7 +92,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
* This list is computed by a materialized view. It won't be populated until a refresh is done
|
||||
* on the materialized view.
|
||||
*
|
||||
* @var Collection<GeographicalUnit>
|
||||
* @var Collection<int, GeographicalUnit>
|
||||
*
|
||||
* @readonly
|
||||
*/
|
||||
@@ -446,7 +446,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setLinkedToThirdParty($linkedToThirdParty): self
|
||||
public function setLinkedToThirdParty(?ThirdParty $linkedToThirdParty): self
|
||||
{
|
||||
$this->linkedToThirdParty = $linkedToThirdParty;
|
||||
|
||||
|
@@ -21,9 +21,9 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
class Center implements HasCenterInterface, \Stringable
|
||||
{
|
||||
/**
|
||||
* @var Collection<GroupCenter>
|
||||
* @var Collection<int, GroupCenter>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: GroupCenter::class, mappedBy: 'center')]
|
||||
#[ORM\OneToMany(mappedBy: 'center', targetEntity: GroupCenter::class)]
|
||||
private Collection $groupCenters;
|
||||
|
||||
#[Serializer\Groups(['docgen:read'])]
|
||||
@@ -40,7 +40,7 @@ class Center implements HasCenterInterface, \Stringable
|
||||
private bool $isActive = true;
|
||||
|
||||
/**
|
||||
* @var Collection<Regroupment>
|
||||
* @var Collection<int, Regroupment>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Regroupment::class, mappedBy: 'centers')]
|
||||
private Collection $regroupments;
|
||||
@@ -111,7 +111,7 @@ class Center implements HasCenterInterface, \Stringable
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
|
@@ -61,10 +61,7 @@ class CommentEmbeddable
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userId
|
||||
*/
|
||||
public function setUserId($userId)
|
||||
public function setUserId(?int $userId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class PrivateCommentEmbeddable
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setComments($comments)
|
||||
public function setComments(array $comments)
|
||||
{
|
||||
$this->comments = $comments;
|
||||
|
||||
|
@@ -36,9 +36,9 @@ class GeographicalUnitLayer
|
||||
private string $refId = '';
|
||||
|
||||
/**
|
||||
* @var Collection<GeographicalUnit>
|
||||
* @var Collection<int, GeographicalUnit>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: GeographicalUnit::class, mappedBy: 'layer')]
|
||||
#[ORM\OneToMany(mappedBy: 'layer', targetEntity: GeographicalUnit::class)]
|
||||
private Collection $units;
|
||||
|
||||
public function __construct()
|
||||
|
@@ -34,7 +34,7 @@ class GroupCenter
|
||||
private ?PermissionsGroup $permissionsGroup = null;
|
||||
|
||||
/**
|
||||
* @var Collection<User::class>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'groupCenters')]
|
||||
private Collection $users;
|
||||
|
@@ -59,11 +59,9 @@ class Language
|
||||
/**
|
||||
* Set id.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return Language
|
||||
*/
|
||||
public function setId($id)
|
||||
public function setId(?string $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
@@ -77,7 +75,7 @@ class Language
|
||||
*
|
||||
* @return Language
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(array $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
|
@@ -30,7 +30,7 @@ class Notification implements TrackUpdateInterface
|
||||
private array $addedAddresses = [];
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
#[ORM\JoinTable(name: 'chill_main_notification_addresses_user')]
|
||||
@@ -54,9 +54,9 @@ class Notification implements TrackUpdateInterface
|
||||
private ?ArrayCollection $addressesOnLoad = null;
|
||||
|
||||
/**
|
||||
* @var Collection<NotificationComment>
|
||||
* @var Collection<int, NotificationComment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: NotificationComment::class, mappedBy: 'notification', orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'notification', targetEntity: NotificationComment::class, orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::ASC])]
|
||||
private Collection $comments;
|
||||
|
||||
@@ -88,7 +88,7 @@ class Notification implements TrackUpdateInterface
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
#[ORM\JoinTable(name: 'chill_main_notification_addresses_unread')]
|
||||
|
@@ -28,9 +28,9 @@ class PermissionsGroup
|
||||
private array $flags = [];
|
||||
|
||||
/**
|
||||
* @var Collection<GroupCenter>
|
||||
* @var Collection<int, GroupCenter>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: GroupCenter::class, mappedBy: 'permissionsGroup')]
|
||||
#[ORM\OneToMany(mappedBy: 'permissionsGroup', targetEntity: GroupCenter::class)]
|
||||
private Collection $groupCenters;
|
||||
|
||||
#[ORM\Id]
|
||||
@@ -42,7 +42,7 @@ class PermissionsGroup
|
||||
private string $name = '';
|
||||
|
||||
/**
|
||||
* @var Collection<RoleScope>
|
||||
* @var Collection<int, RoleScope>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: RoleScope::class, inversedBy: 'permissionsGroups', cascade: ['persist'])]
|
||||
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
|
||||
@@ -137,7 +137,7 @@ class PermissionsGroup
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
|
@@ -157,11 +157,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
|
||||
/**
|
||||
* Set code.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return PostalCode
|
||||
*/
|
||||
public function setCode($code)
|
||||
public function setCode(?string $code)
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
@@ -183,11 +181,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
|
||||
/**
|
||||
* Set name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return PostalCode
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(?string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
@@ -197,11 +193,9 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
|
||||
/**
|
||||
* Set origin.
|
||||
*
|
||||
* @param int $origin
|
||||
*
|
||||
* @return PostalCode
|
||||
*/
|
||||
public function setOrigin($origin)
|
||||
public function setOrigin(int $origin)
|
||||
{
|
||||
$this->origin = $origin;
|
||||
|
||||
|
@@ -20,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class Regroupment
|
||||
{
|
||||
/**
|
||||
* @var Collection<Center>
|
||||
* @var Collection<int, Center>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Center::class, inversedBy: 'regroupments')]
|
||||
#[ORM\Id]
|
||||
|
@@ -26,7 +26,7 @@ class RoleScope
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @var Collection<PermissionsGroup>
|
||||
* @var Collection<int, PermissionsGroup>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: PermissionsGroup::class, mappedBy: 'roleScopes')]
|
||||
private Collection $permissionsGroups;
|
||||
|
@@ -42,9 +42,9 @@ class Scope
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @var Collection<RoleScope>
|
||||
* @var Collection<int, RoleScope>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: RoleScope::class, mappedBy: 'scope')]
|
||||
#[ORM\OneToMany(mappedBy: 'scope', targetEntity: RoleScope::class)]
|
||||
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
|
||||
private Collection $roleScopes;
|
||||
|
||||
|
@@ -64,7 +64,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
private bool $enabled = true;
|
||||
|
||||
/**
|
||||
* @var Collection<GroupCenter>
|
||||
* @var Collection<int, \Chill\MainBundle\Entity\GroupCenter>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: GroupCenter::class, inversedBy: 'users')]
|
||||
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE')]
|
||||
@@ -83,9 +83,9 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
private ?Location $mainLocation = null;
|
||||
|
||||
/**
|
||||
* @var Collection&Selectable<int, UserScopeHistory>
|
||||
* @var \Doctrine\Common\Collections\Collection<int, \Chill\MainBundle\Entity\User\UserScopeHistory>&Selectable
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: UserScopeHistory::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserScopeHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
private Collection&Selectable $scopeHistories;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
|
||||
@@ -98,9 +98,9 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
private ?string $salt = null;
|
||||
|
||||
/**
|
||||
* @var Collection&Selectable<int, UserJobHistory>
|
||||
* @var \Doctrine\Common\Collections\Collection<int, \Chill\MainBundle\Entity\User\UserJobHistory>&Selectable
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: UserJobHistory::class, mappedBy: 'user', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserJobHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
private Collection&Selectable $jobHistories;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 80)]
|
||||
@@ -437,7 +437,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail($email)
|
||||
public function setEmail(?string $email)
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
@@ -447,7 +447,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmailCanonical($emailCanonical)
|
||||
public function setEmailCanonical(?string $emailCanonical)
|
||||
{
|
||||
$this->emailCanonical = $emailCanonical;
|
||||
|
||||
@@ -521,7 +521,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setPassword($password)
|
||||
public function setPassword(string $password)
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
@@ -531,7 +531,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setSalt($salt)
|
||||
public function setSalt(?string $salt)
|
||||
{
|
||||
$this->salt = $salt;
|
||||
|
||||
@@ -593,7 +593,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setUsernameCanonical($usernameCanonical)
|
||||
public function setUsernameCanonical(?string $usernameCanonical)
|
||||
{
|
||||
$this->usernameCanonical = $usernameCanonical;
|
||||
|
||||
|
@@ -35,7 +35,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
use TrackUpdateTrait;
|
||||
|
||||
/**
|
||||
* @var Collection<EntityWorkflowComment>
|
||||
* @var Collection<int, \Chill\MainBundle\Entity\Workflow\EntityWorkflowComment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: EntityWorkflowComment::class, mappedBy: 'entityWorkflow', orphanRemoval: true)]
|
||||
private Collection $comments;
|
||||
@@ -52,10 +52,10 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
private int $relatedEntityId;
|
||||
|
||||
/**
|
||||
* @var Collection<EntityWorkflowStep>
|
||||
* @var Collection<int, EntityWorkflowStep>
|
||||
*/
|
||||
#[Assert\Valid(traverse: true)]
|
||||
#[ORM\OneToMany(targetEntity: EntityWorkflowStep::class, mappedBy: 'entityWorkflow', orphanRemoval: true, cascade: ['persist'])]
|
||||
#[ORM\OneToMany(mappedBy: 'entityWorkflow', targetEntity: EntityWorkflowStep::class, cascade: ['persist'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['transitionAt' => \Doctrine\Common\Collections\Criteria::ASC, 'id' => 'ASC'])]
|
||||
private Collection $steps;
|
||||
|
||||
@@ -65,14 +65,14 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
private ?array $stepsChainedCache = null;
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
#[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_final')]
|
||||
private Collection $subscriberToFinal;
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
#[ORM\JoinTable(name: 'chill_main_workflow_entity_subscriber_to_step')]
|
||||
@@ -247,12 +247,16 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->steps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getStepsChained(): array
|
||||
{
|
||||
if (\is_array($this->stepsChainedCache)) {
|
||||
return $this->stepsChainedCache;
|
||||
}
|
||||
|
||||
/** @var \ArrayIterator $iterator */
|
||||
$iterator = $this->steps->getIterator();
|
||||
$current = null;
|
||||
$steps = [];
|
||||
|
@@ -26,7 +26,7 @@ class EntityWorkflowStep
|
||||
private string $accessKey;
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: User::class)]
|
||||
#[ORM\JoinTable(name: 'chill_main_workflow_entity_step_cc_user')]
|
||||
|
@@ -20,11 +20,11 @@ use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class AddressReferenceRepository implements ObjectRepository
|
||||
final readonly class AddressReferenceRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityManagerInterface $entityManager;
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class AddressRepository implements ObjectRepository
|
||||
final readonly class AddressRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class CenterRepository implements CenterRepositoryInterface
|
||||
final readonly class CenterRepository implements CenterRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class CountryRepository implements ObjectRepository
|
||||
final readonly class CountryRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\GeographicalUnitLayer;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
|
||||
final readonly class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
|
@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
final class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
|
||||
final readonly class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
|
@@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class GroupCenterRepository implements ObjectRepository
|
||||
final readonly class GroupCenterRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -15,9 +15,9 @@ use Chill\MainBundle\Entity\Language;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
final class LanguageRepository implements LanguageRepositoryInterface
|
||||
final readonly class LanguageRepository implements LanguageRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class PermissionsGroupRepository implements ObjectRepository
|
||||
final readonly class PermissionsGroupRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -19,11 +19,11 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
|
||||
final class PostalCodeRepository implements PostalCodeRepositoryInterface
|
||||
final readonly class PostalCodeRepository implements PostalCodeRepositoryInterface
|
||||
{
|
||||
private readonly EntityManagerInterface $entityManager;
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -18,9 +18,9 @@ use Doctrine\ORM\NonUniqueResultException;
|
||||
use Doctrine\ORM\NoResultException;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class RegroupmentRepository implements ObjectRepository
|
||||
final readonly class RegroupmentRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class RoleScopeRepository implements ObjectRepository
|
||||
final readonly class RoleScopeRepository implements ObjectRepository
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -17,11 +17,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
final class ScopeRepository implements ScopeRepositoryInterface
|
||||
final readonly class ScopeRepository implements ScopeRepositoryInterface
|
||||
{
|
||||
private readonly EntityRepository $repository;
|
||||
private EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager, private readonly TranslatableStringHelperInterface $translatableStringHelper)
|
||||
public function __construct(EntityManagerInterface $entityManager, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
$this->repository = $entityManager->getRepository(Scope::class);
|
||||
}
|
||||
|
@@ -53,14 +53,17 @@ export const handleAdd = (button: any): void => {
|
||||
let
|
||||
empty_explain: HTMLLIElement | null = collection.querySelector('li[data-collection-empty-explain]'),
|
||||
entry = document.createElement('li'),
|
||||
counter = collection.childNodes.length + 1,
|
||||
content = prototype.replace(new RegExp('__name__', 'g'), counter.toString()),
|
||||
counter = collection.querySelectorAll('li.entry').length, // Updated counter logic
|
||||
content = prototype.replace(/__name__/g, counter.toString()),
|
||||
event = new CustomEvent('collection-add-entry', {detail: new CollectionEventPayload(collection, entry)});
|
||||
|
||||
console.log(counter)
|
||||
console.log(content)
|
||||
|
||||
entry.innerHTML = content;
|
||||
entry.classList.add('entry');
|
||||
|
||||
if ("dataCollectionRegular" in collection.dataset) {
|
||||
if ("collectionRegular" in collection.dataset) {
|
||||
initializeRemove(collection, entry);
|
||||
if (empty_explain !== null) {
|
||||
empty_explain.remove();
|
||||
|
@@ -159,3 +159,5 @@ document.addEventListener('DOMContentLoaded', function(e) {
|
||||
loadDynamicPicker(document)
|
||||
})
|
||||
|
||||
window.loadDynamicPicker = loadDynamicPicker;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{% set formId = crudMainFormId|default('crud_main_form') %}
|
||||
|
||||
|
||||
{% block crud_content_header %}
|
||||
<h1 class="mb-5">{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
|
||||
{% endblock crud_content_header %}
|
||||
@@ -21,9 +21,9 @@
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
{% block content_form_actions_back %}
|
||||
<li class="cancel">
|
||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
{# <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">#}
|
||||
{# {{ 'Cancel'|trans }}#}
|
||||
{# </a>#}
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_before %}{% endblock %}
|
||||
|
@@ -32,7 +32,7 @@ abstract class AbstractSearch implements SearchInterface
|
||||
{
|
||||
try {
|
||||
return new \DateTime($string);
|
||||
} catch (ParsingException $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$exception = new ParsingException('The date is '
|
||||
.'not parsable', 0, $ex);
|
||||
|
||||
|
@@ -200,7 +200,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
|
||||
*
|
||||
* @return bool true if the user has access
|
||||
*/
|
||||
public function userHasAccess(User $user, mixed $entity, string $attribute)
|
||||
public function userHasAccess(UserInterface $user, mixed $entity, string $attribute): bool
|
||||
{
|
||||
$centers = $this->centerResolverManager->resolveCenters($entity);
|
||||
|
||||
|
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\Import;
|
||||
|
||||
use League\Csv\Reader;
|
||||
use League\Csv\Statement;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class AddressReferenceLU
|
||||
{
|
||||
private const RELEASE = 'https://data.public.lu/fr/datasets/r/5cadc5b8-6a7d-4283-87bc-f9e58dd771f7';
|
||||
|
||||
public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $addressBaseImporter, private readonly PostalCodeBaseImporter $postalCodeBaseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {}
|
||||
|
||||
public function import(): void
|
||||
{
|
||||
$downloadUrl = self::RELEASE;
|
||||
|
||||
$response = $this->client->request('GET', $downloadUrl);
|
||||
|
||||
if (200 !== $response->getStatusCode()) {
|
||||
throw new \Exception('Could not download CSV: '.$response->getStatusCode());
|
||||
}
|
||||
|
||||
$file = tmpfile();
|
||||
|
||||
foreach ($this->client->stream($response) as $chunk) {
|
||||
fwrite($file, $chunk->getContent());
|
||||
}
|
||||
|
||||
fseek($file, 0);
|
||||
|
||||
$csv = Reader::createFromStream($file);
|
||||
$csv->setDelimiter(';');
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
$this->process_postal_code($csv);
|
||||
|
||||
$this->process_address($csv);
|
||||
|
||||
$this->addressToReferenceMatcher->checkAddressesMatchingReferences();
|
||||
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
private function process_address(Reader $csv): void
|
||||
{
|
||||
$stmt = Statement::create()->process($csv);
|
||||
foreach ($stmt as $record) {
|
||||
$this->addressBaseImporter->importAddress(
|
||||
$record['id_geoportail'],
|
||||
$record['code_postal'],
|
||||
$record['code_postal'],
|
||||
$record['rue'],
|
||||
$record['numero'],
|
||||
'bd-addresses.lux',
|
||||
(float) $record['lat_wgs84'],
|
||||
(float) $record['lon_wgs84'],
|
||||
4326
|
||||
);
|
||||
}
|
||||
|
||||
$this->addressBaseImporter->finalize();
|
||||
}
|
||||
|
||||
private function process_postal_code(Reader $csv): void
|
||||
{
|
||||
$stmt = Statement::create()->process($csv);
|
||||
$arr_postal_codes = [];
|
||||
foreach ($stmt as $record) {
|
||||
if (false === \array_key_exists($record['code_postal'], $arr_postal_codes)) {
|
||||
$this->postalCodeBaseImporter->importCode(
|
||||
'LU',
|
||||
trim((string) $record['localite']),
|
||||
trim((string) $record['code_postal']),
|
||||
trim((string) $record['code_postal']),
|
||||
'bd-addresses.lux',
|
||||
(float) $record['lat_wgs84'],
|
||||
(float) $record['lon_wgs84'],
|
||||
4326
|
||||
);
|
||||
$arr_postal_codes[$record['code_postal']] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -205,7 +205,7 @@ final class FilterOrderHelper
|
||||
return null !== $this->searchBoxFields;
|
||||
}
|
||||
|
||||
public function setSearchBox($searchBoxFields = null): self
|
||||
public function setSearchBox(?array $searchBoxFields = null): self
|
||||
{
|
||||
$this->searchBoxFields = $searchBoxFields;
|
||||
|
||||
|
@@ -15,11 +15,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class TranslatableStringHelper implements TranslatableStringHelperInterface
|
||||
final readonly class TranslatableStringHelper implements TranslatableStringHelperInterface
|
||||
{
|
||||
private readonly string $defaultLocale;
|
||||
private string $defaultLocale;
|
||||
|
||||
public function __construct(private readonly RequestStack $requestStack, private readonly TranslatorInterface $translator, ParameterBagInterface $parameterBag)
|
||||
public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator, ParameterBagInterface $parameterBag)
|
||||
{
|
||||
$this->defaultLocale = $parameterBag->get('kernel.default_locale');
|
||||
}
|
||||
|
@@ -11,14 +11,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Tests\Search;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Description of AbstractSearch.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AbstractSearchTest extends \PHPUnit\Framework\TestCase
|
||||
final class AbstractSearchTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Chill\MainBundle\Search\AbstractSearch
|
||||
|
@@ -59,6 +59,12 @@ services:
|
||||
tags:
|
||||
- { name: console.command }
|
||||
|
||||
Chill\MainBundle\Command\LoadAddressesLUFromBDAddressCommand:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
tags:
|
||||
- { name: console.command }
|
||||
|
||||
Chill\MainBundle\Command\ExecuteCronJobCommand:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
|
Reference in New Issue
Block a user