mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-12 17:55:00 +00:00
Compare commits
13 Commits
2.5.3
...
rector/rul
Author | SHA1 | Date | |
---|---|---|---|
74ed34ba97
|
|||
6e6f19c499
|
|||
075aca493b
|
|||
224c2c74e8
|
|||
737f5f9275
|
|||
07c681fcec
|
|||
1c7d90a6ef
|
|||
24c33b306b
|
|||
7e19419861
|
|||
c35994203d
|
|||
9027cbd196
|
|||
dde3002100
|
|||
d8870e906f
|
@@ -1,3 +0,0 @@
|
|||||||
## v2.5.3 - 2023-07-20
|
|
||||||
### Fixed
|
|
||||||
* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous.
|
|
@@ -6,10 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||||
|
|
||||||
|
|
||||||
## v2.5.3 - 2023-07-20
|
|
||||||
### Fixed
|
|
||||||
* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous.
|
|
||||||
|
|
||||||
## v2.5.2 - 2023-07-15
|
## v2.5.2 - 2023-07-15
|
||||||
### Fixed
|
### Fixed
|
||||||
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
||||||
|
@@ -1,80 +0,0 @@
|
|||||||
# Contributing
|
|
||||||
|
|
||||||
Chill is an open source, community-driven project.
|
|
||||||
|
|
||||||
If you'd like to contribute, please read the following.
|
|
||||||
|
|
||||||
## What can you do ?
|
|
||||||
|
|
||||||
Chill is an open-source project driven by a community of developers, users and social workers. If you don't feel ready to contribute code or patches, reviewing issues and pull requests (PRs) can be a great start to get involved and give back.
|
|
||||||
|
|
||||||
If you don't have your own instance or don't want to use it, you can try to reproduce bugs using the instance https://demo.chill.social
|
|
||||||
|
|
||||||
## Core team
|
|
||||||
|
|
||||||
The core team is the group of developers that determine the direction and evolution of the Chill project. Their votes rule if the features and patches proposed by the community are approved or rejected.
|
|
||||||
|
|
||||||
All the Chill Core members are long-time contributors with solid technical expertise and they have demonstrated a strong commitment to drive the project forward.
|
|
||||||
|
|
||||||
The core team:
|
|
||||||
|
|
||||||
- elects his own members;
|
|
||||||
- merge pull requests;
|
|
||||||
|
|
||||||
### members
|
|
||||||
|
|
||||||
Project leader: [julienfastre](https://gitlab.com/julienfastre)
|
|
||||||
|
|
||||||
Core members:
|
|
||||||
|
|
||||||
- [tchama](https://gitlab.com/tchama)
|
|
||||||
- [LenaertsJ](https://gitlab.com/LenaertsJ)
|
|
||||||
- [nobohan](https://gitlab.com/nobohan)
|
|
||||||
|
|
||||||
### Becoming a project member
|
|
||||||
|
|
||||||
About once a year, the core team discusses the opportunity to invite new members. To become a core team member, you must:
|
|
||||||
|
|
||||||
- take part on the development for at least 6 month: propose multiple merge requests and participate to the peer review process;
|
|
||||||
- through this participation, demonstrate your technical skills and your knowledge of the software and any of their dependencies;
|
|
||||||
|
|
||||||
### Core Membership Revocation
|
|
||||||
|
|
||||||
A Symfony Core membership can be revoked for any of the following reasons:
|
|
||||||
|
|
||||||
- Refusal to follow the rules and policies stated in this document;
|
|
||||||
- Lack of activity for the past six months;
|
|
||||||
- Willful negligence or intent to harm the Chill project;
|
|
||||||
|
|
||||||
The decision is taken by the majority of project members.
|
|
||||||
|
|
||||||
## Code development rules
|
|
||||||
|
|
||||||
### Merge requests
|
|
||||||
|
|
||||||
Every merge request must contains:
|
|
||||||
|
|
||||||
- one more entries suitable for generating a changelog. This is done using the [changie utility](https://changie.dev);
|
|
||||||
- a comprehensible description of the changes;
|
|
||||||
- if applicable, automated tests should be adapted or created;
|
|
||||||
- the code style must pass the project's rules, and non phpstan errors must be raised nor rector refactoring suggestion.
|
|
||||||
|
|
||||||
The pipelines must pass.
|
|
||||||
|
|
||||||
In case of emergency, some rules may be temporarily ignored.
|
|
||||||
|
|
||||||
### Merge Request Voting Policy
|
|
||||||
|
|
||||||
- -1 votes must always be justified by technical and objective reasons;
|
|
||||||
- +1 (technically: approbation on the merge request) votes do not require justification, unless there is at least one -1 vote;
|
|
||||||
- Core members can change their votes as many times as they desire during the course of a merge request discussion;
|
|
||||||
- Core members are not allowed to vote on their own merge requests.
|
|
||||||
|
|
||||||
### Merge Request Merging Process
|
|
||||||
|
|
||||||
All code must be committed to the repository through merge requests, except for minor changes which can be committed directly to the repository.
|
|
||||||
|
|
||||||
### Release Policy
|
|
||||||
|
|
||||||
The Core members are also the release manager for every Chill version.
|
|
||||||
|
|
@@ -54,18 +54,9 @@ class CountPerson implements ExportInterface
|
|||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
// the Closure which will be executed by the formatter.
|
// the Closure which will be executed by the formatter.
|
||||||
return function ($value) {
|
return fn($value) => match ($value) {
|
||||||
switch ($value) {
|
'_header' => $this->getTitle(),
|
||||||
case '_header':
|
default => $value,
|
||||||
// we have to process specifically the '_header' string,
|
|
||||||
// which will be used by the formatter to show a column title
|
|
||||||
return $this->getTitle();
|
|
||||||
|
|
||||||
default:
|
|
||||||
// for all value, we do not process them and return them
|
|
||||||
// immediatly
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,19 +23,12 @@ class ChillMainConfiguration implements ConfigurationInterface
|
|||||||
{
|
{
|
||||||
use AddWidgetConfigurationTrait;
|
use AddWidgetConfigurationTrait;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ContainerBuilder
|
|
||||||
*/
|
|
||||||
private $containerBuilder;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
array $widgetFactories,
|
array $widgetFactories,
|
||||||
ContainerBuilder $containerBuilder
|
private ContainerBuilder $containerBuilder
|
||||||
) {
|
) {
|
||||||
// we register here widget factories (see below)
|
// we register here widget factories (see below)
|
||||||
$this->setWidgetFactories($widgetFactories);
|
$this->setWidgetFactories($widgetFactories);
|
||||||
// we will need the container builder later...
|
|
||||||
$this->containerBuilder = $containerBuilder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder()
|
||||||
|
24
rector.php
24
rector.php
@@ -21,7 +21,7 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
//define sets of rules
|
//define sets of rules
|
||||||
$rectorConfig->sets([
|
$rectorConfig->sets([
|
||||||
LevelSetList::UP_TO_PHP_74
|
LevelSetList::UP_TO_PHP_80
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// chill rules
|
// chill rules
|
||||||
@@ -37,27 +37,5 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
// must merge MR500 and review a typing of "ArrayCollection" in entities
|
// must merge MR500 and review a typing of "ArrayCollection" in entities
|
||||||
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
|
\Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
|
||||||
|
|
||||||
// remove all PHP80 rules, in order to activate them one by one
|
|
||||||
\Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\DoctrineAnnotationClassToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class,
|
|
||||||
\Rector\Php80\Rector\Ternary\GetDebugTypeRector::class,
|
|
||||||
\Rector\Php80\Rector\FunctionLike\MixedTypeRector::class,
|
|
||||||
\Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class,
|
|
||||||
\Rector\Php80\Rector\ClassMethod\SetStateToStaticRector::class,
|
|
||||||
\Rector\Php80\Rector\NotIdentical\StrContainsRector::class,
|
|
||||||
\Rector\Php80\Rector\Identical\StrEndsWithRector::class,
|
|
||||||
\Rector\Php80\Rector\Identical\StrStartsWithRector::class,
|
|
||||||
\Rector\Php80\Rector\Class_\StringableForToStringRector::class,
|
|
||||||
\Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector::class,
|
|
||||||
\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
@@ -77,10 +77,8 @@ final class ActivityController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a Activity entity.
|
* Deletes a Activity entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function deleteAction(Request $request, $id)
|
public function deleteAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$view = null;
|
$view = null;
|
||||||
|
|
||||||
|
@@ -47,10 +47,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a form to edit an existing ActivityReasonCategory entity.
|
* Displays a form to edit an existing ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function editAction($id)
|
public function editAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -98,10 +96,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds and displays a ActivityReasonCategory entity.
|
* Finds and displays a ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -118,10 +114,8 @@ class ActivityReasonCategoryController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits an existing ActivityReasonCategory entity.
|
* Edits an existing ActivityReasonCategory entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function updateAction(Request $request, $id)
|
public function updateAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
@@ -24,11 +24,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
*/
|
*/
|
||||||
class ActivityReasonController extends AbstractController
|
class ActivityReasonController extends AbstractController
|
||||||
{
|
{
|
||||||
private ActivityReasonRepository $activityReasonRepository;
|
public function __construct(private ActivityReasonRepository $activityReasonRepository)
|
||||||
|
|
||||||
public function __construct(ActivityReasonRepository $activityReasonRepository)
|
|
||||||
{
|
{
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +53,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a form to edit an existing ActivityReason entity.
|
* Displays a form to edit an existing ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function editAction($id)
|
public function editAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -107,10 +102,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds and displays a ActivityReason entity.
|
* Finds and displays a ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction(mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
@@ -127,10 +120,8 @@ class ActivityReasonController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits an existing ActivityReason entity.
|
* Edits an existing ActivityReason entity.
|
||||||
*
|
|
||||||
* @param mixed $id
|
|
||||||
*/
|
*/
|
||||||
public function updateAction(Request $request, $id)
|
public function updateAction(Request $request, mixed $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
@@ -25,17 +25,14 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
{
|
{
|
||||||
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Faker\Generator
|
* @var \Faker\Generator
|
||||||
*/
|
*/
|
||||||
private $faker;
|
private $faker;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(private EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->faker = FakerFactory::create('fr_FR');
|
$this->faker = FakerFactory::create('fr_FR');
|
||||||
$this->em = $em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
|
@@ -104,6 +104,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
|
||||||
* @Assert\Valid(traverse=true)
|
* @Assert\Valid(traverse=true)
|
||||||
|
* @var Collection<StoredObject>
|
||||||
*/
|
*/
|
||||||
private Collection $documents;
|
private Collection $documents;
|
||||||
|
|
||||||
@@ -140,8 +141,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<Person>
|
||||||
*/
|
*/
|
||||||
private ?Collection $persons = null;
|
private Collection $persons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
||||||
@@ -151,6 +153,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||||
* @Groups({"docgen:read"})
|
* @Groups({"docgen:read"})
|
||||||
|
* @var Collection<ActivityReason>
|
||||||
*/
|
*/
|
||||||
private Collection $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
@@ -170,6 +173,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialAction")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<SocialAction>
|
||||||
*/
|
*/
|
||||||
private Collection $socialActions;
|
private Collection $socialActions;
|
||||||
|
|
||||||
@@ -177,14 +181,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\SocialWork\SocialIssue")
|
||||||
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<SocialIssue>
|
||||||
*/
|
*/
|
||||||
private Collection $socialIssues;
|
private Collection $socialIssues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<ThirdParty>
|
||||||
*/
|
*/
|
||||||
private ?Collection $thirdParties = null;
|
private Collection $thirdParties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="time", nullable=true)
|
* @ORM\Column(type="time", nullable=true)
|
||||||
@@ -200,8 +206,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
* @Groups({"read", "docgen:read"})
|
* @Groups({"read", "docgen:read"})
|
||||||
|
* @var Collection<User>
|
||||||
*/
|
*/
|
||||||
private ?Collection $users = null;
|
private Collection $users;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@@ -23,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
class ActivityReason
|
class ActivityReason
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ActivityReasonCategory
|
* @var ActivityReasonCategory
|
||||||
@@ -34,7 +33,7 @@ class ActivityReason
|
|||||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
* targetEntity="Chill\ActivityBundle\Entity\ActivityReasonCategory",
|
||||||
* inversedBy="reasons")
|
* inversedBy="reasons")
|
||||||
*/
|
*/
|
||||||
private $category;
|
private ?ActivityReasonCategory $category = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
@@ -43,13 +42,13 @@ class ActivityReason
|
|||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private array $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active.
|
* Get active.
|
||||||
@@ -81,27 +80,9 @@ class ActivityReason
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name.
|
* Get name.
|
||||||
*
|
|
||||||
* @param mixed|null $locale
|
|
||||||
*
|
|
||||||
* @return array | string
|
|
||||||
*/
|
*/
|
||||||
public function getName($locale = null)
|
public function getName(): array
|
||||||
{
|
{
|
||||||
if ($locale) {
|
|
||||||
if (isset($this->name[$locale])) {
|
|
||||||
return $this->name[$locale];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->name as $name) {
|
|
||||||
if (!empty($name)) {
|
|
||||||
return $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* @ORM\Table(name="activityreasoncategory")
|
* @ORM\Table(name="activityreasoncategory")
|
||||||
* @ORM\HasLifecycleCallbacks
|
* @ORM\HasLifecycleCallbacks
|
||||||
*/
|
*/
|
||||||
class ActivityReasonCategory
|
class ActivityReasonCategory implements \Stringable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
@@ -47,12 +48,12 @@ class ActivityReasonCategory
|
|||||||
/**
|
/**
|
||||||
* Array of ActivityReason.
|
* Array of ActivityReason.
|
||||||
*
|
*
|
||||||
* @var ArrayCollection
|
* @var Collection<ActivityReason>
|
||||||
* @ORM\OneToMany(
|
* @ORM\OneToMany(
|
||||||
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
* targetEntity="Chill\ActivityBundle\Entity\ActivityReason",
|
||||||
* mappedBy="category")
|
* mappedBy="category")
|
||||||
*/
|
*/
|
||||||
private $reasons;
|
private Collection $reasons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityReasonCategory constructor.
|
* ActivityReasonCategory constructor.
|
||||||
@@ -65,7 +66,7 @@ class ActivityReasonCategory
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
||||||
}
|
}
|
||||||
|
@@ -275,10 +275,8 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Assert\Callback
|
* @Assert\Callback
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
*/
|
||||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload)
|
||||||
{
|
{
|
||||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
||||||
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityEntityListener
|
class ActivityEntityListener
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $em;
|
public function __construct(private EntityManagerInterface $em, private AccompanyingPeriodWorkRepository $workRepository)
|
||||||
|
|
||||||
private AccompanyingPeriodWorkRepository $workRepository;
|
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
|
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
|
||||||
$this->workRepository = $workRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function persistActionToCourse(Activity $activity)
|
public function persistActionToCourse(Activity $activity)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByCreatorAggregator implements AggregatorInterface
|
class ByCreatorAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||||
|
{
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
UserRepositoryInterface $userRepository,
|
|
||||||
UserRender $userRender
|
|
||||||
) {
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialActionAggregator implements AggregatorInterface
|
class BySocialActionAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private SocialActionRender $actionRender;
|
public function __construct(private SocialActionRender $actionRender, private SocialActionRepository $actionRepository)
|
||||||
|
{
|
||||||
private SocialActionRepository $actionRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
SocialActionRender $actionRender,
|
|
||||||
SocialActionRepository $actionRepository
|
|
||||||
) {
|
|
||||||
$this->actionRender = $actionRender;
|
|
||||||
$this->actionRepository = $actionRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialIssueAggregator implements AggregatorInterface
|
class BySocialIssueAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private SocialIssueRender $issueRender;
|
public function __construct(private SocialIssueRepository $issueRepository, private SocialIssueRender $issueRender)
|
||||||
|
{
|
||||||
private SocialIssueRepository $issueRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
SocialIssueRepository $issueRepository,
|
|
||||||
SocialIssueRender $issueRender
|
|
||||||
) {
|
|
||||||
$this->issueRepository = $issueRepository;
|
|
||||||
$this->issueRender = $issueRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByThirdpartyAggregator implements AggregatorInterface
|
class ByThirdpartyAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ThirdPartyRender $thirdPartyRender;
|
public function __construct(private ThirdPartyRepository $thirdPartyRepository, private ThirdPartyRender $thirdPartyRender)
|
||||||
|
{
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
|
||||||
ThirdPartyRender $thirdPartyRender
|
|
||||||
) {
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->thirdPartyRender = $thirdPartyRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class CreatorScopeAggregator implements AggregatorInterface
|
class CreatorScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepository $scopeRepository;
|
public function __construct(private ScopeRepository $scopeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepository $scopeRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -94,17 +94,9 @@ class DateAggregator implements AggregatorInterface
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($data['frequency']) {
|
return match ($data['frequency']) {
|
||||||
case 'month':
|
default => $value,
|
||||||
case 'week':
|
};
|
||||||
//return $this->translator->trans('for week') .' '. $value ;
|
|
||||||
|
|
||||||
case 'year':
|
|
||||||
//return $this->translator->trans('in year') .' '. $value ;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,16 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class LocationTypeAggregator implements AggregatorInterface
|
class LocationTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private LocationTypeRepository $locationTypeRepository;
|
public function __construct(private LocationTypeRepository $locationTypeRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
LocationTypeRepository $locationTypeRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->locationTypeRepository = $locationTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -24,16 +24,8 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public const KEY = 'activity_type_aggregator';
|
public const KEY = 'activity_type_aggregator';
|
||||||
|
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected ActivityTypeRepositoryInterface $activityTypeRepository, protected TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ class ActivityUserAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public const KEY = 'activity_user_id';
|
public const KEY = 'activity_user_id';
|
||||||
|
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepository $userRepository, private UserRender $userRender)
|
||||||
|
{
|
||||||
private UserRepository $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
UserRepository $userRepository,
|
|
||||||
UserRender $userRender
|
|
||||||
) {
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,14 +21,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersAggregator implements AggregatorInterface
|
class ActivityUsersAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRepositoryInterface $userRepository, private UserRender $userRender)
|
||||||
|
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(UserRepositoryInterface $userRepository, UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private UserJobRepositoryInterface $userJobRepository;
|
|
||||||
|
|
||||||
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->userJobRepository = $userJobRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,14 +20,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -30,20 +30,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonCategoryRepository $activityReasonCategoryRepository;
|
public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper)
|
||||||
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
|
||||||
|
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityReasonCategoryRepository $activityReasonCategoryRepository,
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
TranslatableStringHelper $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityReasonCategoryRepository = $activityReasonCategoryRepository;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@@ -117,21 +105,11 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
// for performance reason, we load data from db only once
|
match ($data['level']) {
|
||||||
switch ($data['level']) {
|
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
|
||||||
case 'reasons':
|
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
|
||||||
$this->activityReasonRepository->findBy(['id' => $values]);
|
default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||||
|
};
|
||||||
break;
|
|
||||||
|
|
||||||
case 'categories':
|
|
||||||
$this->activityReasonCategoryRepository->findBy(['id' => $values]);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level']));
|
|
||||||
}
|
|
||||||
|
|
||||||
return function ($value) use ($data) {
|
return function ($value) use ($data) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class SentReceivedAggregator implements AggregatorInterface
|
class SentReceivedAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -24,20 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $entityManager;
|
public function __construct(private ListActivityHelper $helper, private EntityManagerInterface $entityManager, private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper)
|
||||||
|
{
|
||||||
private ListActivityHelper $helper;
|
|
||||||
|
|
||||||
private TranslatableStringExportLabelHelper $translatableStringExportLabelHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ListActivityHelper $helper,
|
|
||||||
EntityManagerInterface $entityManager,
|
|
||||||
TranslatableStringExportLabelHelper $translatableStringExportLabelHelper
|
|
||||||
) {
|
|
||||||
$this->helper = $helper;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->translatableStringExportLabelHelper = $translatableStringExportLabelHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -66,22 +54,17 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'acpId':
|
'acpId' => static function ($value) {
|
||||||
return static function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
|
},
|
||||||
|
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'),
|
||||||
|
default => $this->helper->getLabels($key, $values, $data),
|
||||||
};
|
};
|
||||||
|
|
||||||
case 'scopesNames':
|
|
||||||
return $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles');
|
|
||||||
|
|
||||||
default:
|
|
||||||
return $this->helper->getLabels($key, $values, $data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
|
@@ -24,12 +24,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected ActivityRepository $activityRepository;
|
public function __construct(protected ActivityRepository $activityRepository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
ActivityRepository $activityRepository
|
|
||||||
) {
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -36,8 +36,6 @@ use function in_array;
|
|||||||
|
|
||||||
class ListActivity implements ListInterface, GroupedExportInterface
|
class ListActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
protected EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
protected array $fields = [
|
protected array $fields = [
|
||||||
'id',
|
'id',
|
||||||
'date',
|
'date',
|
||||||
@@ -52,22 +50,8 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
'person_id',
|
'person_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(protected EntityManagerInterface $entityManager, protected TranslatorInterface $translator, protected TranslatableStringHelperInterface $translatableStringHelper, private ActivityRepository $activityRepository)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ActivityRepository $activityRepository
|
|
||||||
) {
|
|
||||||
$this->entityManager = $em;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -32,22 +32,16 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
public const SUM = 'sum';
|
public const SUM = 'sum';
|
||||||
|
|
||||||
/**
|
|
||||||
* The action for this report.
|
|
||||||
*/
|
|
||||||
protected string $action;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $action the stat to perform
|
* @param string $action the stat to perform
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ActivityRepository $activityRepository,
|
private ActivityRepository $activityRepository,
|
||||||
string $action = 'sum'
|
/**
|
||||||
|
* The action for this report.
|
||||||
|
*/
|
||||||
|
protected string $action = 'sum'
|
||||||
) {
|
) {
|
||||||
$this->action = $action;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -32,44 +32,8 @@ class ListActivityHelper
|
|||||||
{
|
{
|
||||||
public const MSG_KEY = 'export.list.activity.';
|
public const MSG_KEY = 'export.list.activity.';
|
||||||
|
|
||||||
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
|
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private ActivityTypeRepositoryInterface $activityTypeRepository, private DateTimeHelper $dateTimeHelper, private LabelPersonHelper $labelPersonHelper, private LabelThirdPartyHelper $labelThirdPartyHelper, private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper, private TranslatableStringExportLabelHelper $translatableStringLabelHelper, private UserHelper $userHelper)
|
||||||
|
{
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
|
||||||
|
|
||||||
private DateTimeHelper $dateTimeHelper;
|
|
||||||
|
|
||||||
private LabelPersonHelper $labelPersonHelper;
|
|
||||||
|
|
||||||
private LabelThirdPartyHelper $labelThirdPartyHelper;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatableStringExportLabelHelper $translatableStringLabelHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private UserHelper $userHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityPresenceRepositoryInterface $activityPresenceRepository,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
DateTimeHelper $dateTimeHelper,
|
|
||||||
LabelPersonHelper $labelPersonHelper,
|
|
||||||
LabelThirdPartyHelper $labelThirdPartyHelper,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
TranslatableStringExportLabelHelper $translatableStringLabelHelper,
|
|
||||||
UserHelper $userHelper
|
|
||||||
) {
|
|
||||||
$this->activityPresenceRepository = $activityPresenceRepository;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->dateTimeHelper = $dateTimeHelper;
|
|
||||||
$this->labelPersonHelper = $labelPersonHelper;
|
|
||||||
$this->labelThirdPartyHelper = $labelThirdPartyHelper;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->translatableStringLabelHelper = $translatableStringLabelHelper;
|
|
||||||
$this->userHelper = $userHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addSelect(QueryBuilder $qb): void
|
public function addSelect(QueryBuilder $qb): void
|
||||||
@@ -115,20 +79,11 @@ class ListActivityHelper
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'createdAt':
|
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
|
||||||
case 'updatedAt':
|
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
|
||||||
return $this->dateTimeHelper->getLabel($key);
|
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key),
|
||||||
|
'attendeeName' => function ($value) {
|
||||||
case 'createdBy':
|
|
||||||
case 'updatedBy':
|
|
||||||
return $this->userHelper->getLabel($key, $values, $key);
|
|
||||||
|
|
||||||
case 'date':
|
|
||||||
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
|
|
||||||
|
|
||||||
case 'attendeeName':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Attendee';
|
return 'Attendee';
|
||||||
}
|
}
|
||||||
@@ -138,13 +93,9 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($presence->getName());
|
return $this->translatableStringHelper->localize($presence->getName());
|
||||||
};
|
},
|
||||||
|
'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'),
|
||||||
case 'listReasons':
|
'typeName' => function ($value) {
|
||||||
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
|
|
||||||
|
|
||||||
case 'typeName':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Activity type';
|
return 'Activity type';
|
||||||
}
|
}
|
||||||
@@ -154,29 +105,15 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($type->getName());
|
return $this->translatableStringHelper->localize($type->getName());
|
||||||
};
|
},
|
||||||
|
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
|
||||||
case 'usersNames':
|
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
|
||||||
return $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name');
|
|
||||||
|
|
||||||
case 'usersIds':
|
|
||||||
case 'thirdPartiesIds':
|
|
||||||
case 'personsIds':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'usersIds':
|
'usersIds' => self::MSG_KEY . 'users ids',
|
||||||
return self::MSG_KEY . 'users ids';
|
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
|
||||||
|
'personsIds' => self::MSG_KEY . 'persons ids',
|
||||||
case 'thirdPartiesIds':
|
};
|
||||||
return self::MSG_KEY . 'third parties ids';
|
|
||||||
|
|
||||||
case 'personsIds':
|
|
||||||
return self::MSG_KEY . 'persons ids';
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException('key not supported');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
||||||
@@ -188,16 +125,10 @@ class ListActivityHelper
|
|||||||
SORT_NUMERIC
|
SORT_NUMERIC
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
|
||||||
case 'personsNames':
|
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
|
||||||
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
|
'sentReceived' => function ($value) {
|
||||||
|
|
||||||
case 'thirdPartiesNames':
|
|
||||||
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
|
|
||||||
|
|
||||||
case 'sentReceived':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return self::MSG_KEY . 'sent received';
|
return self::MSG_KEY . 'sent received';
|
||||||
}
|
}
|
||||||
@@ -207,10 +138,8 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translator->trans($value);
|
return $this->translator->trans($value);
|
||||||
};
|
},
|
||||||
|
default => function ($value) use ($key) {
|
||||||
default:
|
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return self::MSG_KEY . $key;
|
return self::MSG_KEY . $key;
|
||||||
}
|
}
|
||||||
@@ -220,9 +149,9 @@ class ListActivityHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translator->trans($value);
|
return $this->translator->trans($value);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
{
|
{
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ActivityTypeFilter implements FilterInterface
|
class ActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(private ActivityTypeRepositoryInterface $activityTypeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByCreatorFilter implements FilterInterface
|
class ByCreatorFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialActionFilter implements FilterInterface
|
class BySocialActionFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private SocialActionRender $actionRender;
|
public function __construct(private SocialActionRender $actionRender)
|
||||||
|
|
||||||
public function __construct(SocialActionRender $actionRender)
|
|
||||||
{
|
{
|
||||||
$this->actionRender = $actionRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class BySocialIssueFilter implements FilterInterface
|
class BySocialIssueFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private SocialIssueRender $issueRender;
|
public function __construct(private SocialIssueRender $issueRender)
|
||||||
|
|
||||||
public function __construct(SocialIssueRender $issueRender)
|
|
||||||
{
|
{
|
||||||
$this->issueRender = $issueRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -28,11 +28,8 @@ class EmergencyFilter implements FilterInterface
|
|||||||
|
|
||||||
private const DEFAULT_CHOICE = false;
|
private const DEFAULT_CHOICE = false;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class LocationTypeFilter implements FilterInterface
|
class LocationTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -29,11 +29,8 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
|
|
||||||
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UserFilter implements FilterInterface
|
class UserFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,11 +23,8 @@ use function in_array;
|
|||||||
|
|
||||||
class UserScopeFilter implements FilterInterface
|
class UserScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -27,16 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ActivityDateFilter implements FilterInterface
|
class ActivityDateFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
protected TranslatorInterface $translator;
|
public function __construct(protected TranslatorInterface $translator, private RollingDateConverterInterface $rollingDateConverter)
|
||||||
|
{
|
||||||
private RollingDateConverterInterface $rollingDateConverter;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
RollingDateConverterInterface $rollingDateConverter
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->rollingDateConverter = $rollingDateConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -26,16 +26,8 @@ use function count;
|
|||||||
|
|
||||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ActivityUsersFilter implements FilterInterface
|
class ActivityUsersFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -29,16 +29,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelper $helper,
|
|
||||||
ActivityReasonRepository $activityReasonRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $helper;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -37,20 +37,8 @@ use function count;
|
|||||||
|
|
||||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
protected ActivityReasonRepository $activityReasonRepository;
|
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersJobFilter implements FilterInterface
|
class UsersJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersScopeFilter implements FilterInterface
|
class UsersScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -58,40 +58,22 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityType extends AbstractType
|
class ActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
protected AuthorizationHelper $authorizationHelper;
|
|
||||||
|
|
||||||
protected ObjectManager $om;
|
|
||||||
|
|
||||||
protected SocialActionRender $socialActionRender;
|
|
||||||
|
|
||||||
protected SocialIssueRender $socialIssueRender;
|
|
||||||
|
|
||||||
protected array $timeChoices;
|
|
||||||
|
|
||||||
protected TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
protected User $user;
|
protected User $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
AuthorizationHelper $authorizationHelper,
|
protected AuthorizationHelper $authorizationHelper,
|
||||||
ObjectManager $om,
|
protected ObjectManager $om,
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
protected TranslatableStringHelper $translatableStringHelper,
|
||||||
array $timeChoices,
|
protected array $timeChoices,
|
||||||
SocialIssueRender $socialIssueRender,
|
protected SocialIssueRender $socialIssueRender,
|
||||||
SocialActionRender $socialActionRender
|
protected SocialActionRender $socialActionRender
|
||||||
) {
|
) {
|
||||||
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
if (!$tokenStorage->getToken()->getUser() instanceof User) {
|
||||||
throw new RuntimeException('you should have a valid user');
|
throw new RuntimeException('you should have a valid user');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = $tokenStorage->getToken()->getUser();
|
$this->user = $tokenStorage->getToken()->getUser();
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->om = $om;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->timeChoices = $timeChoices;
|
|
||||||
$this->socialIssueRender = $socialIssueRender;
|
|
||||||
$this->socialActionRender = $socialActionRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
|
@@ -25,11 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
class ActivityTypeType extends AbstractType
|
class ActivityTypeType extends AbstractType
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -24,20 +24,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
*/
|
*/
|
||||||
class PickActivityReasonType extends AbstractType
|
class PickActivityReasonType extends AbstractType
|
||||||
{
|
{
|
||||||
private ActivityReasonRepository $activityReasonRepository;
|
public function __construct(private ActivityReasonRepository $activityReasonRepository, private ActivityReasonRender $reasonRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private ActivityReasonRender $reasonRender;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ActivityReasonRepository $activityReasonRepository,
|
|
||||||
ActivityReasonRender $reasonRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->activityReasonRepository = $activityReasonRepository;
|
|
||||||
$this->reasonRender = $reasonRender;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -23,14 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class TranslatableActivityReasonCategoryType extends AbstractType
|
class TranslatableActivityReasonCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private TranslatorInterface $translator)
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
class TranslatableActivityType extends AbstractType
|
class TranslatableActivityType extends AbstractType
|
||||||
{
|
{
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, protected ActivityTypeRepositoryInterface $activityTypeRepository)
|
||||||
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $helper,
|
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $helper;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
protected Security $security;
|
public function __construct(protected Security $security, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
Security $security,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->security = $security;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
*/
|
*/
|
||||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -23,22 +23,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
final class PersonMenuBuilder implements LocalMenuBuilderInterface
|
final class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(private AuthorizationCheckerInterface $authorizationChecker, private TranslatorInterface $translator)
|
||||||
* @var AuthorizationCheckerInterface
|
{
|
||||||
*/
|
|
||||||
private $authorizationChecker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
private $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AuthorizationCheckerInterface $authorizationChecker,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -18,11 +18,8 @@ use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
|||||||
|
|
||||||
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
||||||
{
|
{
|
||||||
private ActivityRepository $activityRepository;
|
public function __construct(private ActivityRepository $activityRepository)
|
||||||
|
|
||||||
public function __construct(ActivityRepository $activityRepository)
|
|
||||||
{
|
{
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTemplate(Notification $notification, array $options = []): string
|
public function getTemplate(Notification $notification, array $options = []): string
|
||||||
|
@@ -23,15 +23,11 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
|||||||
*/
|
*/
|
||||||
class ActivityReasonRepository extends ServiceEntityRepository
|
class ActivityReasonRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
private RequestStack $requestStack;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ManagerRegistry $registry,
|
ManagerRegistry $registry,
|
||||||
RequestStack $requestStack
|
private RequestStack $requestStack
|
||||||
) {
|
) {
|
||||||
parent::__construct($registry, ActivityReason::class);
|
parent::__construct($registry, ActivityReason::class);
|
||||||
|
|
||||||
$this->requestStack = $requestStack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -74,15 +74,12 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
self::FULL,
|
self::FULL,
|
||||||
];
|
];
|
||||||
|
|
||||||
protected Security $security;
|
|
||||||
|
|
||||||
protected VoterHelperInterface $voterHelper;
|
protected VoterHelperInterface $voterHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Security $security,
|
protected Security $security,
|
||||||
VoterHelperFactoryInterface $voterHelperFactory
|
VoterHelperFactoryInterface $voterHelperFactory
|
||||||
) {
|
) {
|
||||||
$this->security = $security;
|
|
||||||
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
||||||
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||||
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
||||||
|
@@ -42,48 +42,17 @@ class ActivityContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private BaseContextData $baseContextData;
|
|
||||||
|
|
||||||
private DocumentCategoryRepository $documentCategoryRepository;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRenderInterface $personRender;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private ThirdPartyRender $thirdPartyRender;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
DocumentCategoryRepository $documentCategoryRepository,
|
private NormalizerInterface $normalizer,
|
||||||
NormalizerInterface $normalizer,
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
private EntityManagerInterface $em,
|
||||||
EntityManagerInterface $em,
|
private PersonRenderInterface $personRender,
|
||||||
PersonRenderInterface $personRender,
|
private PersonRepository $personRepository,
|
||||||
PersonRepository $personRepository,
|
private TranslatorInterface $translator,
|
||||||
TranslatorInterface $translator,
|
private BaseContextData $baseContextData,
|
||||||
BaseContextData $baseContextData,
|
private ThirdPartyRender $thirdPartyRender,
|
||||||
ThirdPartyRender $thirdPartyRender,
|
private ThirdPartyRepository $thirdPartyRepository
|
||||||
ThirdPartyRepository $thirdPartyRepository
|
|
||||||
) {
|
) {
|
||||||
$this->documentCategoryRepository = $documentCategoryRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->personRender = $personRender;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->baseContextData = $baseContextData;
|
|
||||||
$this->thirdPartyRender = $thirdPartyRender;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@@ -48,44 +48,8 @@ class ListActivitiesByAccompanyingPeriodContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private AccompanyingPeriodContext $accompanyingPeriodContext;
|
public function __construct(private AccompanyingPeriodContext $accompanyingPeriodContext, private ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private NormalizerInterface $normalizer, private PersonRepository $personRepository, private SocialActionRepository $socialActionRepository, private SocialIssueRepository $socialIssueRepository, private ThirdPartyRepository $thirdPartyRepository, private TranslatableStringHelperInterface $translatableStringHelper, private UserRepository $userRepository)
|
||||||
|
{
|
||||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private SocialActionRepository $socialActionRepository;
|
|
||||||
|
|
||||||
private SocialIssueRepository $socialIssueRepository;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private UserRepository $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AccompanyingPeriodContext $accompanyingPeriodContext,
|
|
||||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
|
||||||
NormalizerInterface $normalizer,
|
|
||||||
PersonRepository $personRepository,
|
|
||||||
SocialActionRepository $socialActionRepository,
|
|
||||||
SocialIssueRepository $socialIssueRepository,
|
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
UserRepository $userRepository,
|
|
||||||
) {
|
|
||||||
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
|
|
||||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->socialActionRepository = $socialActionRepository;
|
|
||||||
$this->socialIssueRepository = $socialIssueRepository;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
@@ -21,14 +21,8 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|||||||
|
|
||||||
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
|
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
|
||||||
{
|
{
|
||||||
private StoredObjectRepository $objectRepository;
|
public function __construct(private StoredObjectRepository $objectRepository, private ActivityRepository $activityRepository)
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
public function __construct(StoredObjectRepository $storedObjectRepository, ActivityRepository $activityRepository)
|
|
||||||
{
|
{
|
||||||
$this->objectRepository = $storedObjectRepository;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||||
|
@@ -76,10 +76,8 @@ final class ActivityControllerTest extends WebTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getSecuredPagesUnauthenticated
|
* @dataProvider getSecuredPagesUnauthenticated
|
||||||
*
|
|
||||||
* @param mixed $url
|
|
||||||
*/
|
*/
|
||||||
public function testAccessIsDeniedForUnauthenticated($url)
|
public function testAccessIsDeniedForUnauthenticated(mixed $url)
|
||||||
{
|
{
|
||||||
$client = $this->createClient();
|
$client = $this->createClient();
|
||||||
|
|
||||||
@@ -262,11 +260,9 @@ final class ActivityControllerTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $username
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\BrowserKit\Client
|
* @return \Symfony\Component\BrowserKit\Client
|
||||||
*/
|
*/
|
||||||
private function getAuthenticatedClient($username = 'center a_social')
|
private function getAuthenticatedClient(mixed $username = 'center a_social')
|
||||||
{
|
{
|
||||||
return self::createClient([], [
|
return self::createClient([], [
|
||||||
'PHP_AUTH_USER' => $username,
|
'PHP_AUTH_USER' => $username,
|
||||||
|
@@ -89,11 +89,9 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $active
|
|
||||||
*
|
|
||||||
* @return \Chill\ActivityBundle\Entity\ActivityType
|
* @return \Chill\ActivityBundle\Entity\ActivityType
|
||||||
*/
|
*/
|
||||||
protected function getRandomType($active = true)
|
protected function getRandomType(mixed $active = true)
|
||||||
{
|
{
|
||||||
$types = $this->container->get('doctrine.orm.entity_manager')
|
$types = $this->container->get('doctrine.orm.entity_manager')
|
||||||
->getRepository(ActivityType::class)
|
->getRepository(ActivityType::class)
|
||||||
|
@@ -33,24 +33,14 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
|||||||
{
|
{
|
||||||
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
||||||
|
|
||||||
protected ActivityACLAwareRepository $aclAwareRepository;
|
|
||||||
|
|
||||||
protected EntityManagerInterface $em;
|
|
||||||
|
|
||||||
protected AuthorizationHelperInterface $helper;
|
|
||||||
|
|
||||||
protected UserInterface $user;
|
protected UserInterface $user;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
protected EntityManagerInterface $em,
|
||||||
AuthorizationHelperInterface $helper,
|
protected AuthorizationHelperInterface $helper,
|
||||||
TokenStorageInterface $storage,
|
TokenStorageInterface $storage,
|
||||||
ActivityACLAwareRepository $aclAwareRepository
|
protected ActivityACLAwareRepository $aclAwareRepository
|
||||||
) {
|
) {
|
||||||
$this->em = $em;
|
|
||||||
$this->helper = $helper;
|
|
||||||
$this->aclAwareRepository = $aclAwareRepository;
|
|
||||||
|
|
||||||
if (!$storage->getToken()->getUser() instanceof User) {
|
if (!$storage->getToken()->getUser() instanceof User) {
|
||||||
throw new RuntimeException('A user should be authenticated !');
|
throw new RuntimeException('A user should be authenticated !');
|
||||||
}
|
}
|
||||||
|
@@ -21,11 +21,8 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
|
|
||||||
final class AsideActivityController extends CRUDController
|
final class AsideActivityController extends CRUDController
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $categoryRepository;
|
public function __construct(private AsideActivityCategoryRepository $categoryRepository)
|
||||||
|
|
||||||
public function __construct(AsideActivityCategoryRepository $categoryRepository)
|
|
||||||
{
|
{
|
||||||
$this->categoryRepository = $categoryRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createEntity(string $action, Request $request): object
|
public function createEntity(string $action, Request $request): object
|
||||||
|
@@ -24,11 +24,8 @@ use function random_int;
|
|||||||
|
|
||||||
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||||
{
|
{
|
||||||
private UserRepository $userRepository;
|
public function __construct(private UserRepository $userRepository)
|
||||||
|
|
||||||
public function __construct(UserRepository $userRepository)
|
|
||||||
{
|
{
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependencies(): array
|
public function getDependencies(): array
|
||||||
|
@@ -25,8 +25,9 @@ class AsideActivityCategory
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
||||||
|
* @var Collection<AsideActivityCategory>
|
||||||
*/
|
*/
|
||||||
private $children;
|
private Collection $children;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
@@ -36,7 +37,6 @@ class AsideActivityCategory
|
|||||||
private int $id;
|
private int $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=AsideActivityCategory::class, mappedBy="parent")
|
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
private bool $isActive = true;
|
private bool $isActive = true;
|
||||||
@@ -114,10 +114,8 @@ class AsideActivityCategory
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Assert\Callback
|
* @Assert\Callback
|
||||||
*
|
|
||||||
* @param mixed $payload
|
|
||||||
*/
|
*/
|
||||||
public function preventRecursiveParent(ExecutionContextInterface $context, $payload)
|
public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload)
|
||||||
{
|
{
|
||||||
if (!$this->hasParent()) {
|
if (!$this->hasParent()) {
|
||||||
return;
|
return;
|
||||||
|
@@ -20,14 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByActivityTypeAggregator implements AggregatorInterface
|
class ByActivityTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(AsideActivityCategoryRepository $asideActivityCategoryRepository, TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByUserJobAggregator implements AggregatorInterface
|
class ByUserJobAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private UserJobRepositoryInterface $userJobRepository;
|
|
||||||
|
|
||||||
public function __construct(UserJobRepositoryInterface $userJobRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->userJobRepository = $userJobRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,14 +22,8 @@ use function in_array;
|
|||||||
|
|
||||||
class ByUserScopeAggregator implements AggregatorInterface
|
class ByUserScopeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(ScopeRepositoryInterface $scopeRepository, TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -34,40 +34,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
|
public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private CategoryRender $categoryRender;
|
|
||||||
|
|
||||||
private CenterRepositoryInterface $centerRepository;
|
|
||||||
|
|
||||||
private DateTimeHelper $dateTimeHelper;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private UserHelper $userHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
DateTimeHelper $dateTimeHelper,
|
|
||||||
UserHelper $userHelper,
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
CenterRepositoryInterface $centerRepository,
|
|
||||||
AsideActivityCategoryRepository $asideActivityCategoryRepository,
|
|
||||||
CategoryRender $categoryRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->em = $em;
|
|
||||||
$this->dateTimeHelper = $dateTimeHelper;
|
|
||||||
$this->userHelper = $userHelper;
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->centerRepository = $centerRepository;
|
|
||||||
$this->asideActivityCategoryRepository = $asideActivityCategoryRepository;
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@@ -95,19 +63,15 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
return match ($key) {
|
||||||
case 'id':
|
'id', 'note' => static function ($value) use ($key) {
|
||||||
case 'note':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
};
|
},
|
||||||
|
'duration' => static function ($value) use ($key) {
|
||||||
case 'duration':
|
|
||||||
return static function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.' . $key;
|
return 'export.aside_activity.' . $key;
|
||||||
}
|
}
|
||||||
@@ -121,19 +85,10 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
};
|
},
|
||||||
|
'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key),
|
||||||
case 'createdAt':
|
'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key),
|
||||||
case 'updatedAt':
|
'aside_activity_type' => function ($value) {
|
||||||
case 'date':
|
|
||||||
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
|
||||||
|
|
||||||
case 'agent_id':
|
|
||||||
case 'creator_id':
|
|
||||||
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
|
|
||||||
|
|
||||||
case 'aside_activity_type':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.aside_activity_type';
|
return 'export.aside_activity.aside_activity_type';
|
||||||
}
|
}
|
||||||
@@ -143,10 +98,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->categoryRender->renderString($c, []);
|
return $this->categoryRender->renderString($c, []);
|
||||||
};
|
},
|
||||||
|
'main_scope' => function ($value) {
|
||||||
case 'main_scope':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.main_scope';
|
return 'export.aside_activity.main_scope';
|
||||||
}
|
}
|
||||||
@@ -156,10 +109,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($c->getName());
|
return $this->translatableStringHelper->localize($c->getName());
|
||||||
};
|
},
|
||||||
|
'main_center' => function ($value) {
|
||||||
case 'main_center':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.aside_activity.main_center';
|
return 'export.aside_activity.main_center';
|
||||||
}
|
}
|
||||||
@@ -170,11 +121,9 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $c->getName();
|
return $c->getName();
|
||||||
|
},
|
||||||
|
default => throw new LogicException('this key is not supported : ' . $key),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
|
||||||
throw new LogicException('this key is not supported : ' . $key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data)
|
||||||
|
@@ -23,12 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
private AsideActivityRepository $repository;
|
public function __construct(private AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -23,20 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByActivityTypeFilter implements FilterInterface
|
class ByActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private AsideActivityCategoryRepository $asideActivityTypeRepository;
|
public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository)
|
||||||
|
{
|
||||||
private CategoryRender $categoryRender;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
AsideActivityCategoryRepository $asideActivityTypeRepository
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
$this->asideActivityTypeRepository = $asideActivityTypeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -26,16 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ByDateFilter implements FilterInterface
|
class ByDateFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
protected TranslatorInterface $translator;
|
public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
private RollingDateConverterInterface $rollingDateConverter;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
RollingDateConverterInterface $rollingDateConverter,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->rollingDateConverter = $rollingDateConverter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -20,11 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserFilter implements FilterInterface
|
class ByUserFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private UserRender $userRender;
|
public function __construct(private UserRender $userRender)
|
||||||
|
|
||||||
public function __construct(UserRender $userRender)
|
|
||||||
{
|
{
|
||||||
$this->userRender = $userRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,11 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserJobFilter implements FilterInterface
|
class ByUserJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -23,16 +23,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ByUserScopeFilter implements FilterInterface
|
class ByUserScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private ScopeRepositoryInterface $scopeRepository;
|
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||||
|
{
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
ScopeRepositoryInterface $scopeRepository,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper
|
|
||||||
) {
|
|
||||||
$this->scopeRepository = $scopeRepository;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -22,12 +22,8 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final class AsideActivityCategoryType extends AbstractType
|
final class AsideActivityCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private CategoryRender $categoryRender;
|
public function __construct(private CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -20,12 +20,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
final class PickAsideActivityCategoryType extends AbstractType
|
final class PickAsideActivityCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
private CategoryRender $categoryRender;
|
public function __construct(private CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -16,11 +16,8 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
|
|
||||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -21,14 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
*/
|
*/
|
||||||
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
public AuthorizationCheckerInterface $authorizationChecker;
|
public function __construct(protected TranslatorInterface $translator, public AuthorizationCheckerInterface $authorizationChecker)
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,14 +27,8 @@ final class CategoryRender implements ChillEntityRenderInterface
|
|||||||
|
|
||||||
public const SEPERATOR_KEY = 'default.separator';
|
public const SEPERATOR_KEY = 'default.separator';
|
||||||
|
|
||||||
private EngineInterface $engine;
|
public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine)
|
||||||
|
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper, EngineInterface $engine)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->engine = $engine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildParents(AsideActivityCategory $asideActivityCategory)
|
public function buildParents(AsideActivityCategory $asideActivityCategory)
|
||||||
|
@@ -27,20 +27,8 @@ use function get_class;
|
|||||||
|
|
||||||
abstract class AbstractElementController extends AbstractController
|
abstract class AbstractElementController extends AbstractController
|
||||||
{
|
{
|
||||||
protected LoggerInterface $chillMainLogger;
|
public function __construct(protected EntityManagerInterface $em, protected TranslatorInterface $translator, protected LoggerInterface $chillMainLogger)
|
||||||
|
{
|
||||||
protected EntityManagerInterface $em;
|
|
||||||
|
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
LoggerInterface $chillMainLogger
|
|
||||||
) {
|
|
||||||
$this->em = $em;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->chillMainLogger = $chillMainLogger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,11 +36,8 @@ abstract class AbstractElementController extends AbstractController
|
|||||||
* "{_locale}/family-members/family-members/{id}/delete",
|
* "{_locale}/family-members/family-members/{id}/delete",
|
||||||
* name="chill_family_members_family_members_delete"
|
* name="chill_family_members_family_members_delete"
|
||||||
* ).
|
* ).
|
||||||
*
|
|
||||||
* @param mixed $template
|
|
||||||
* @param mixed $flashMessage
|
|
||||||
*/
|
*/
|
||||||
protected function _delete(AbstractElement $element, Request $request, $template, $flashMessage): Response
|
protected function _delete(AbstractElement $element, Request $request, mixed $template, mixed $flashMessage): Response
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted(BudgetElementVoter::DELETE, $element, 'You are not '
|
$this->denyAccessUnlessGranted(BudgetElementVoter::DELETE, $element, 'You are not '
|
||||||
. 'allowed to delete this item');
|
. 'allowed to delete this item');
|
||||||
@@ -72,7 +57,7 @@ abstract class AbstractElementController extends AbstractController
|
|||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
$this->chillMainLogger->notice('A budget element has been removed', [
|
$this->chillMainLogger->notice('A budget element has been removed', [
|
||||||
'family_element' => get_class($element),
|
'family_element' => $element::class,
|
||||||
'by_user' => $this->getUser()->getUsername(),
|
'by_user' => $this->getUser()->getUsername(),
|
||||||
'family_member_id' => $element->getId(),
|
'family_member_id' => $element->getId(),
|
||||||
'amount' => $element->getAmount(),
|
'amount' => $element->getAmount(),
|
||||||
@@ -141,12 +126,7 @@ abstract class AbstractElementController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function _new(mixed $entity, Request $request, mixed $template, mixed $flashMessageOnSuccess)
|
||||||
* @param mixed $template
|
|
||||||
* @param mixed $flashMessageOnSuccess
|
|
||||||
* @param mixed $entity
|
|
||||||
*/
|
|
||||||
protected function _new($entity, Request $request, $template, $flashMessageOnSuccess)
|
|
||||||
{
|
{
|
||||||
/** @var AbstractElement $element */
|
/** @var AbstractElement $element */
|
||||||
$element = $this->createNewElement();
|
$element = $this->createNewElement();
|
||||||
@@ -196,10 +176,8 @@ abstract class AbstractElementController extends AbstractController
|
|||||||
* "{_locale}/family-members/family-members/{id}/view",
|
* "{_locale}/family-members/family-members/{id}/view",
|
||||||
* name="chill_family_members_family_members_view"
|
* name="chill_family_members_family_members_view"
|
||||||
* ).
|
* ).
|
||||||
*
|
|
||||||
* @param mixed $template
|
|
||||||
*/
|
*/
|
||||||
protected function _view(AbstractElement $element, $template)
|
protected function _view(AbstractElement $element, mixed $template)
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $element);
|
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $element);
|
||||||
|
|
||||||
|
@@ -31,20 +31,8 @@ use function count;
|
|||||||
|
|
||||||
class ElementController extends AbstractController
|
class ElementController extends AbstractController
|
||||||
{
|
{
|
||||||
private CalculatorManager $calculator;
|
public function __construct(private CalculatorManager $calculator, private ResourceRepository $resourceRepository, private ChargeRepository $chargeRepository)
|
||||||
|
{
|
||||||
private ResourceRepository $resourceRepository;
|
|
||||||
|
|
||||||
private ChargeRepository $chargeRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
CalculatorManager $calculator,
|
|
||||||
ResourceRepository $resourceRepository,
|
|
||||||
ChargeRepository $chargeRepository,
|
|
||||||
) {
|
|
||||||
$this->calculator = $calculator;
|
|
||||||
$this->resourceRepository = $resourceRepository;
|
|
||||||
$this->chargeRepository = $chargeRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,20 +27,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ChargeType extends AbstractType
|
class ChargeType extends AbstractType
|
||||||
{
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ChargeKindRepository $repository, private TranslatorInterface $translator)
|
||||||
|
{
|
||||||
private ChargeKindRepository $repository;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ChargeKindRepository $repository,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -26,20 +26,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class ResourceType extends AbstractType
|
class ResourceType extends AbstractType
|
||||||
{
|
{
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
public function __construct(protected TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepository $repository, private TranslatorInterface $translator)
|
||||||
|
{
|
||||||
private ResourceKindRepository $repository;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ResourceKindRepository $repository,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
|
|
||||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
class HouseholdMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AuthorizationCheckerInterface $authorizationChecker,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -20,16 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class PersonMenuBuilder implements LocalMenuBuilderInterface
|
class PersonMenuBuilder implements LocalMenuBuilderInterface
|
||||||
{
|
{
|
||||||
protected AuthorizationCheckerInterface $authorizationChecker;
|
public function __construct(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||||
|
{
|
||||||
protected TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AuthorizationCheckerInterface $authorizationChecker,
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->authorizationChecker = $authorizationChecker;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
@@ -37,24 +37,8 @@ final class SummaryBudget implements SummaryBudgetInterface
|
|||||||
|
|
||||||
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id';
|
private const QUERY_RESOURCE_BY_PERSON = 'select SUM(amount) AS sum, string_agg(comment, \'|\') AS comment, resource_id AS kind_id FROM chill_budget.resource WHERE person_id = ? AND NOW() BETWEEN startdate AND COALESCE(enddate, \'infinity\'::timestamp) GROUP BY resource_id';
|
||||||
|
|
||||||
private ChargeKindRepositoryInterface $chargeKindRepository;
|
public function __construct(private EntityManagerInterface $em, private TranslatableStringHelperInterface $translatableStringHelper, private ResourceKindRepositoryInterface $resourceKindRepository, private ChargeKindRepositoryInterface $chargeKindRepository)
|
||||||
|
{
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ResourceKindRepositoryInterface $resourceKindRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
ResourceKindRepositoryInterface $resourceKindRepository,
|
|
||||||
ChargeKindRepositoryInterface $chargeKindRepository
|
|
||||||
) {
|
|
||||||
$this->em = $em;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->resourceKindRepository = $resourceKindRepository;
|
|
||||||
$this->chargeKindRepository = $chargeKindRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSummaryForHousehold(?Household $household): array
|
public function getSummaryForHousehold(?Household $household): array
|
||||||
|
@@ -22,14 +22,8 @@ use Symfony\Component\Templating\EngineInterface;
|
|||||||
*/
|
*/
|
||||||
final class BudgetElementTypeRender implements ChillEntityRenderInterface
|
final class BudgetElementTypeRender implements ChillEntityRenderInterface
|
||||||
{
|
{
|
||||||
private EngineInterface $engine;
|
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private EngineInterface $engine)
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelperInterface $translatableStringHelper, EngineInterface $engine)
|
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->engine = $engine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderBox($entity, array $options): string
|
public function renderBox($entity, array $options): string
|
||||||
|
@@ -66,11 +66,11 @@ final class SummaryBudgetTest extends TestCase
|
|||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$em = $this->prophesize(EntityManagerInterface::class);
|
||||||
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
|
||||||
->will(static function ($args) use ($queryResources, $queryCharges) {
|
->will(static function ($args) use ($queryResources, $queryCharges) {
|
||||||
if (false !== strpos($args[0], 'chill_budget.resource')) {
|
if (str_contains($args[0], 'chill_budget.resource')) {
|
||||||
return $queryResources->reveal();
|
return $queryResources->reveal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== strpos($args[0], 'chill_budget.charge')) {
|
if (str_contains($args[0], 'chill_budget.charge')) {
|
||||||
return $queryCharges->reveal();
|
return $queryCharges->reveal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,19 +29,9 @@ use TheNetworg\OAuth2\Client\Provider\Azure;
|
|||||||
|
|
||||||
class AzureGrantAdminConsentAndAcquireToken extends Command
|
class AzureGrantAdminConsentAndAcquireToken extends Command
|
||||||
{
|
{
|
||||||
private Azure $azure;
|
public function __construct(private Azure $azure, private ClientRegistry $clientRegistry, private MachineTokenStorage $machineTokenStorage)
|
||||||
|
|
||||||
private ClientRegistry $clientRegistry;
|
|
||||||
|
|
||||||
private MachineTokenStorage $machineTokenStorage;
|
|
||||||
|
|
||||||
public function __construct(Azure $azure, ClientRegistry $clientRegistry, MachineTokenStorage $machineTokenStorage)
|
|
||||||
{
|
{
|
||||||
parent::__construct('chill:calendar:msgraph-grant-admin-consent');
|
parent::__construct('chill:calendar:msgraph-grant-admin-consent');
|
||||||
|
|
||||||
$this->azure = $azure;
|
|
||||||
$this->clientRegistry = $clientRegistry;
|
|
||||||
$this->machineTokenStorage = $machineTokenStorage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
@@ -25,13 +25,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
|
|
||||||
class SendShortMessageOnEligibleCalendar extends Command
|
class SendShortMessageOnEligibleCalendar extends Command
|
||||||
{
|
{
|
||||||
private BulkCalendarShortMessageSender $messageSender;
|
public function __construct(private BulkCalendarShortMessageSender $messageSender)
|
||||||
|
|
||||||
public function __construct(BulkCalendarShortMessageSender $messageSender)
|
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->messageSender = $messageSender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
|
@@ -43,34 +43,15 @@ use function count;
|
|||||||
|
|
||||||
class SendTestShortMessageOnCalendarCommand extends Command
|
class SendTestShortMessageOnCalendarCommand extends Command
|
||||||
{
|
{
|
||||||
private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private PhoneNumberHelperInterface $phoneNumberHelper;
|
|
||||||
|
|
||||||
private PhoneNumberUtil $phoneNumberUtil;
|
|
||||||
|
|
||||||
private ShortMessageTransporterInterface $transporter;
|
|
||||||
|
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
PersonRepository $personRepository,
|
private PersonRepository $personRepository,
|
||||||
PhoneNumberUtil $phoneNumberUtil,
|
private PhoneNumberUtil $phoneNumberUtil,
|
||||||
PhoneNumberHelperInterface $phoneNumberHelper,
|
private PhoneNumberHelperInterface $phoneNumberHelper,
|
||||||
ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
|
private ShortMessageForCalendarBuilderInterface $messageForCalendarBuilder,
|
||||||
ShortMessageTransporterInterface $transporter,
|
private ShortMessageTransporterInterface $transporter,
|
||||||
UserRepositoryInterface $userRepository
|
private UserRepositoryInterface $userRepository
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->phoneNumberUtil = $phoneNumberUtil;
|
|
||||||
$this->phoneNumberHelper = $phoneNumberHelper;
|
|
||||||
$this->messageForCalendarBuilder = $messageForCalendarBuilder;
|
|
||||||
$this->transporter = $transporter;
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user