mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
Add attachments to workflow
This commit is contained in:
@@ -11,10 +11,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocStoreBundle\GenericDoc\Providers;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForAccompanyingPeriodProviderInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
||||
use Chill\DocStoreBundle\Repository\PersonDocumentRepository;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -27,8 +30,38 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe
|
||||
public function __construct(
|
||||
private Security $security,
|
||||
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository,
|
||||
private PersonDocumentRepository $personDocumentRepository,
|
||||
) {}
|
||||
|
||||
public function fetchAssociatedStoredObject(GenericDocDTO $genericDocDTO): ?StoredObject
|
||||
{
|
||||
return $this->personDocumentRepository->find($genericDocDTO->identifiers['id'])?->getObject();
|
||||
}
|
||||
|
||||
public function supportsGenericDoc(GenericDocDTO $genericDocDTO): bool
|
||||
{
|
||||
return $this->supportsKeyAndIdentifiers($genericDocDTO->key, $genericDocDTO->identifiers);
|
||||
}
|
||||
|
||||
public function supportsKeyAndIdentifiers(string $key, array $identifiers): bool
|
||||
{
|
||||
return self::KEY === $key && array_key_exists('id', $identifiers);
|
||||
}
|
||||
|
||||
public function buildOneGenericDoc(string $key, array $identifiers): ?GenericDocDTO
|
||||
{
|
||||
if (null === $document = $this->personDocumentRepository->find($identifiers['id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GenericDocDTO(
|
||||
self::KEY,
|
||||
$identifiers,
|
||||
\DateTimeImmutable::createFromInterface($document->getDate()),
|
||||
$document->getPerson()
|
||||
);
|
||||
}
|
||||
|
||||
public function buildFetchQueryForPerson(
|
||||
Person $person,
|
||||
?\DateTimeImmutable $startDate = null,
|
||||
|
Reference in New Issue
Block a user