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
bb65909bfa
commit
9765bc5663
@ -15,7 +15,6 @@ use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
@ -84,7 +83,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
|
||||
$sql = "
|
||||
$sql = '
|
||||
SELECT
|
||||
a.id AS activity_id,
|
||||
date,
|
||||
@ -118,7 +117,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
WHERE accompanyingperiod_id = ?
|
||||
ORDER BY a.date DESC, a.id DESC
|
||||
LIMIT ?
|
||||
";
|
||||
';
|
||||
|
||||
$rsm
|
||||
->addEntityResult(Activity::class, 'a')
|
||||
@ -133,7 +132,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
->addFieldResult('location', 'phonenumber1', 'phonenumber1')
|
||||
->addFieldResult('location', 'phonenumber2', 'phonenumber2')
|
||||
->addFieldResult('location', 'email', 'email')
|
||||
->addJoinedEntityResult(LocationType::class,'locationType', 'location', 'locationType' )
|
||||
->addJoinedEntityResult(LocationType::class, 'locationType', 'location', 'locationType')
|
||||
->addFieldResult('locationType', 'locationtype_id', 'id')
|
||||
->addFieldResult('locationType', 'locationtype_title', 'title')
|
||||
->addJoinedEntityResult(ActivityType::class, 'activityType', 'a', 'activityType')
|
||||
@ -151,8 +150,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
->addScalarResult('socialactionids', 'socialActionIds', Types::JSON)
|
||||
->addScalarResult('socialissueids', 'socialIssueIds', Types::JSON)
|
||||
->addScalarResult('durationtimeminute', 'durationTimeMinute', Types::INTEGER)
|
||||
->addScalarResult('traveltimeminute', 'travelTimeMinute', Types::INTEGER)
|
||||
;
|
||||
->addScalarResult('traveltimeminute', 'travelTimeMinute', Types::INTEGER);
|
||||
|
||||
$nq = $this->em->createNativeQuery($sql, $rsm);
|
||||
|
||||
|
@ -26,10 +26,6 @@ interface ActivityACLAwareRepositoryInterface
|
||||
*
|
||||
* The aim of this method is to get a long list of activities and keep performance.
|
||||
*
|
||||
* @param AccompanyingPeriod $period
|
||||
* @param string $role
|
||||
* @param int|null $limit
|
||||
* @param array|null $orderBy
|
||||
* @return array an array of array, each item representing an activity
|
||||
*/
|
||||
public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Service\DocGenerator;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
@ -23,6 +32,7 @@ use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Chill\PersonBundle\Service\DocGenerator\AccompanyingPeriodContext;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use DateTime;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
@ -38,18 +48,18 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private PersonRepository $personRepository;
|
||||
|
||||
private SocialActionRepository $socialActionRepository;
|
||||
|
||||
private SocialIssueRepository $socialIssueRepository;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
AccompanyingPeriodContext $accompanyingPeriodContext,
|
||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||
@ -72,6 +82,26 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
public function adminFormReverseTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormReverseTransform($data);
|
||||
}
|
||||
|
||||
public function adminFormTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormTransform($data);
|
||||
}
|
||||
|
||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildAdminForm($builder);
|
||||
}
|
||||
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildPublicForm($builder, $template, $entity);
|
||||
}
|
||||
|
||||
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
|
||||
{
|
||||
$data = $this->accompanyingPeriodContext->getData($template, $entity, $contextGenerationData);
|
||||
@ -81,6 +111,46 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities description';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return AccompanyingPeriod::class;
|
||||
}
|
||||
|
||||
public function getFormData(DocGeneratorTemplate $template, $entity): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->getFormData($template, $entity);
|
||||
}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities';
|
||||
}
|
||||
|
||||
public function hasAdminForm(): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasAdminForm();
|
||||
}
|
||||
|
||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasPublicForm($template, $entity);
|
||||
}
|
||||
|
||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->storeGenerated($template, $storedObject, $entity, $contextGenerationData);
|
||||
}
|
||||
|
||||
private function getActivitiesSimplified(AccompanyingPeriod $period)
|
||||
{
|
||||
$activities =
|
||||
@ -91,20 +161,21 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
$activity = $row[0];
|
||||
|
||||
$activity['date'] = $this->normalizer->normalize($activity['date'], 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => \DateTime::class
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => DateTime::class,
|
||||
]);
|
||||
|
||||
if (null === $activity['location']) {
|
||||
$activity['location'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Location::class
|
||||
$activity['location'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => Location::class,
|
||||
]);
|
||||
$activity['location']['type'] = 'location';
|
||||
} else {
|
||||
$activity['location']['isNull'] = false;
|
||||
$activity['location']['type'] = 'location';
|
||||
|
||||
foreach (['1', '2'] as $key) {
|
||||
$activity['location']['phonenumber'.$key] = $this->normalizer->normalize(
|
||||
$activity['location']['phonenumber'.$key],
|
||||
$activity['location']['phonenumber' . $key] = $this->normalizer->normalize(
|
||||
$activity['location']['phonenumber' . $key],
|
||||
'docgen',
|
||||
[AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => PhoneNumber::class]
|
||||
);
|
||||
@ -127,7 +198,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
$activity['activityType']['type'] = 'activityType';
|
||||
} else {
|
||||
$activity['activityType'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityType::class
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityType::class,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -139,7 +210,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
$activity['attendee']['type'] = 'activityPresence';
|
||||
} else {
|
||||
$activity['attendee'] = $this->normalizer->normalize(null, 'docgen', [
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityPresence::class
|
||||
AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => ActivityPresence::class,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -212,65 +283,4 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities description';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return AccompanyingPeriod::class;
|
||||
}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return 'docgen.Accompanying period with a list of activities';
|
||||
}
|
||||
|
||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->storeGenerated($template, $storedObject, $entity, $contextGenerationData);
|
||||
}
|
||||
|
||||
public function adminFormReverseTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormReverseTransform($data);
|
||||
}
|
||||
|
||||
public function adminFormTransform(array $data): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->adminFormTransform($data);
|
||||
}
|
||||
|
||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildAdminForm($builder);
|
||||
}
|
||||
|
||||
public function hasAdminForm(): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasAdminForm();
|
||||
}
|
||||
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
||||
{
|
||||
$this->accompanyingPeriodContext->buildPublicForm($builder, $template, $entity);
|
||||
}
|
||||
|
||||
public function getFormData(DocGeneratorTemplate $template, $entity): array
|
||||
{
|
||||
return $this->accompanyingPeriodContext->getFormData($template, $entity);
|
||||
}
|
||||
|
||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
||||
{
|
||||
return $this->accompanyingPeriodContext->hasPublicForm($template, $entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user