mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 12:29:43 +00:00
Merge branch 'master' into migrate_to_sf72
# Conflicts: # docs/source/_static/code/exports/BirthdateFilter.php # rector.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByActivityTypeAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityLocationAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityPresenceAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersJobAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUsersScopeAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ByCreatorAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/ByThirdpartyAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorJobAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/CreatorScopeAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/DateAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/LocationTypeAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/HouseholdAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/PersonAggregator.php # src/Bundle/ChillActivityBundle/Export/Aggregator/PersonsAggregator.php # src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php # src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php # src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ActivityTypeFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/HasNoActivityFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/PeriodHavingActivityBetweenDatesFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ActivityPresenceFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ActivityUsersFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/ByCreatorFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/CreatorJobFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/CreatorScopeFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/EmergencyFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/LocationFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/LocationTypeFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/PersonsFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/SentReceivedFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/UserFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/UsersJobFilter.php # src/Bundle/ChillActivityBundle/Export/Filter/UsersScopeFilter.php # src/Bundle/ChillActivityBundle/Validator/Constraints/ActivityValidity.php # src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByActivityTypeAggregator.php # src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserJobAggregator.php # src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByUserScopeAggregator.php # src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByActivityTypeFilter.php # src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php # src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php # src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserJobFilter.php # src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserScopeFilter.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php # src/Bundle/ChillCalendarBundle/Export/Aggregator/UrgencyAggregator.php # src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php # src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php # src/Bundle/ChillCalendarBundle/Export/Filter/CalendarRangeFilter.php # src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php # src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php # src/Bundle/ChillEventBundle/Export/Aggregator/EventDateAggregator.php # src/Bundle/ChillEventBundle/Export/Aggregator/EventTypeAggregator.php # src/Bundle/ChillEventBundle/Export/Aggregator/RoleAggregator.php # src/Bundle/ChillEventBundle/Export/Filter/EventDateFilter.php # src/Bundle/ChillEventBundle/Export/Filter/EventTypeFilter.php # src/Bundle/ChillEventBundle/Export/Filter/RoleFilter.php # src/Bundle/ChillMainBundle/Controller/ExportController.php # src/Bundle/ChillMainBundle/Controller/SavedExportController.php # src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ExportsCompilerPass.php # src/Bundle/ChillMainBundle/Entity/Notification.php # src/Bundle/ChillMainBundle/Export/ExportManager.php # src/Bundle/ChillMainBundle/Export/Formatter/CSVFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php # src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php # src/Bundle/ChillMainBundle/Form/SavedExportType.php # src/Bundle/ChillMainBundle/Form/Type/DataTransformer/EntityToJsonTransformer.php # src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php # src/Bundle/ChillMainBundle/Tests/Export/SortExportElementTest.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/GeographicalUnitStatAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobWorkingOnCourseAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OpeningDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/PersonParticipatingAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/RequestorAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeWorkingOnCourseAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserWorkingOnCourseAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByClosingMotiveAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByEndDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByMaxDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/ByStartDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/HavingEndDateAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AdministrativeStatusAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ByHouseholdCompositionAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CenterAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/EmploymentStatusAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/PostalCodeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalResultAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/HandlingThirdPartyAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php # src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AdministrativeLocationFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ClosingMotiveFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ConfidentialFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HandlingThirdPartyFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/IntensityFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/NotAssociatedWithAReferenceAddressFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OriginFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilterBetweenDates.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/RequestorFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterBetweenDates.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByDateFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodStepHistoryFilters/ByStepFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AddressRefStatusFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ByHouseholdCompositionFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeadOrAliveFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/DeathdateFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GeographicalUnitFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/MaritalStatusFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithParticipationBetweenDatesFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutHouseholdComposition.php # src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/WithoutParticipationBetweenDatesFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php # src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php # src/Bundle/ChillPersonBundle/Export/Helper/FilterListAccompanyingPeriodHelper.php # src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php # src/Bundle/ChillPersonBundle/Tests/Export/Export/ListAccompanyingPeriodTest.php # src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidity.php # src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/ConfidentialCourseMustHaveReferrer.php # src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidity.php # src/Bundle/ChillPersonBundle/Validator/Constraints/Household/MaxHolder.php # src/Bundle/ChillReportBundle/Export/Export/ReportList.php # src/Bundle/ChillReportBundle/Export/Filter/ReportDateFilter.php
This commit is contained in:
@@ -27,7 +27,7 @@ final readonly class AgentAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
if (!\in_array('caluser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('cal.mainUser', 'caluser');
|
||||
@@ -47,12 +47,27 @@ final readonly class AgentAggregator implements AggregatorInterface
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -27,7 +27,7 @@ class CancelReasonAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
// TODO: still needs to take into account calendars without a cancel reason somehow
|
||||
if (!\in_array('calcancel', $qb->getAllAliases(), true)) {
|
||||
@@ -48,12 +48,27 @@ class CancelReasonAggregator implements AggregatorInterface
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -34,7 +34,7 @@ final readonly class JobAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$p = self::PREFIX;
|
||||
|
||||
@@ -67,12 +67,27 @@ final readonly class JobAggregator implements AggregatorInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void {}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -26,7 +26,7 @@ final readonly class LocationAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
if (!\in_array('calloc', $qb->getAllAliases(), true)) {
|
||||
$qb->join('cal.location', 'calloc');
|
||||
@@ -45,12 +45,27 @@ final readonly class LocationAggregator implements AggregatorInterface
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -27,7 +27,7 @@ final readonly class LocationTypeAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
if (!\in_array('calloc', $qb->getAllAliases(), true)) {
|
||||
$qb->join('cal.location', 'calloc');
|
||||
@@ -47,12 +47,27 @@ final readonly class LocationTypeAggregator implements AggregatorInterface
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -23,7 +23,7 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$qb->addSelect("to_char(cal.startDate, 'MM-YYYY') AS month_year_aggregator");
|
||||
// $qb->addSelect("extract(month from age(cal.startDate, cal.endDate)) AS month_aggregator");
|
||||
@@ -40,12 +40,27 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
// No form needed
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return static function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -34,7 +34,7 @@ final readonly class ScopeAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$p = self::PREFIX;
|
||||
|
||||
@@ -67,12 +67,27 @@ final readonly class ScopeAggregator implements AggregatorInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void {}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -33,7 +33,7 @@ class UrgencyAggregator implements AggregatorInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$qb->addSelect('cal.urgent AS urgency_aggregator');
|
||||
$qb->addGroupBy('urgency_aggregator');
|
||||
@@ -49,12 +49,27 @@ class UrgencyAggregator implements AggregatorInterface
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -34,6 +34,21 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
// No form necessary
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -71,7 +86,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
return ['export_result'];
|
||||
}
|
||||
|
||||
public function getResult($query, $data)
|
||||
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||
{
|
||||
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR);
|
||||
}
|
||||
@@ -89,7 +104,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
/**
|
||||
* Initiate the query.
|
||||
*/
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): QueryBuilder
|
||||
{
|
||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||
|
||||
|
@@ -31,6 +31,21 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
// no form needed
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -68,7 +83,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
return ['export_result'];
|
||||
}
|
||||
|
||||
public function getResult($query, $data)
|
||||
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||
{
|
||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
@@ -83,7 +98,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
return Declarations::CALENDAR_TYPE;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): QueryBuilder
|
||||
{
|
||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||
|
||||
|
@@ -31,6 +31,21 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
// no form needed
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -68,7 +83,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
return ['export_result'];
|
||||
}
|
||||
|
||||
public function getResult($query, $data)
|
||||
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||
{
|
||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
@@ -83,7 +98,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
return Declarations::CALENDAR_TYPE;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): QueryBuilder
|
||||
{
|
||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||
|
||||
|
@@ -13,23 +13,27 @@ namespace Chill\CalendarBundle\Export\Filter;
|
||||
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class AgentFilter implements FilterInterface
|
||||
final readonly class AgentFilter implements FilterInterface
|
||||
{
|
||||
public function __construct(private readonly UserRender $userRender) {}
|
||||
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||
|
||||
public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('cal.mainUser', ':agents');
|
||||
@@ -59,12 +63,27 @@ class AgentFilter implements FilterInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return ['accepted_agents' => $this->normalizeDoctrineEntity($formData['accepted_agents'])];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return ['accepted_agents' => $this->denormalizeDoctrineEntity($formData['accepted_agents'], $this->userRepository)];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
public function describeAction($data, ExportGenerationContext $context): array
|
||||
{
|
||||
$users = [];
|
||||
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Export\Filter;
|
||||
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
@@ -28,7 +29,7 @@ class BetweenDatesFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->gte('cal.startDate', ':dateFrom'),
|
||||
@@ -59,12 +60,27 @@ class BetweenDatesFilter implements FilterInterface
|
||||
->add('date_to', PickRollingDateType::class, []);
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return ['date_from' => $formData['date_from']->normalize(), 'date_to' => $formData['date_to']->normalize()];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return ['date_from' => RollingDate::fromNormalized($formData['date_from']), 'date_to' => RollingDate::fromNormalized($formData['date_to'])];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
public function describeAction($data, ExportGenerationContext $context): array
|
||||
{
|
||||
return ['Filtered by calendars between %dateFrom% and %dateTo%', [
|
||||
'%dateFrom%' => $this->rollingDateConverter->convert($data['date_from'])->format('d-m-Y'),
|
||||
|
@@ -19,6 +19,7 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Export\Filter;
|
||||
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
@@ -41,7 +42,7 @@ class CalendarRangeFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
if (null !== $data['hasCalendarRange']) {
|
||||
$qb->andWhere($qb->expr()->isNotNull('cal.calendarRange'));
|
||||
@@ -66,12 +67,27 @@ class CalendarRangeFilter implements FilterInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return ['hasCalendarRange' => $formData['hasCalendarRange']];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return ['hasCalendarRange' => $formData['hasCalendarRange']];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['hasCalendarRange' => self::DEFAULT_CHOICE];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
public function describeAction($data, ExportGenerationContext $context): array
|
||||
{
|
||||
$choice = '';
|
||||
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Export\Filter;
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||
use Chill\MainBundle\Entity\UserJob;
|
||||
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@@ -24,6 +25,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
final readonly class JobFilter implements FilterInterface
|
||||
{
|
||||
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||
private const PREFIX = 'cal_filter_job';
|
||||
|
||||
public function __construct(
|
||||
@@ -36,7 +38,7 @@ final readonly class JobFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$p = self::PREFIX;
|
||||
|
||||
@@ -84,7 +86,22 @@ final readonly class JobFilter implements FilterInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return ['job' => $this->normalizeDoctrineEntity($formData['job'])];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return ['job' => $this->denormalizeDoctrineEntity($formData['job'], $this->userJobRepository)];
|
||||
}
|
||||
|
||||
public function describeAction($data, ExportGenerationContext $context): array
|
||||
{
|
||||
$userJobs = [];
|
||||
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Export\Filter;
|
||||
use Chill\CalendarBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
||||
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@@ -25,6 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class ScopeFilter implements FilterInterface
|
||||
{
|
||||
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||
private const PREFIX = 'cal_filter_scope';
|
||||
|
||||
public function __construct(
|
||||
@@ -38,7 +40,7 @@ class ScopeFilter implements FilterInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$p = self::PREFIX;
|
||||
|
||||
@@ -86,7 +88,22 @@ class ScopeFilter implements FilterInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return ['scope' => $this->normalizeDoctrineEntity($formData['scope'])];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return ['scope' => $this->denormalizeDoctrineEntity($formData['scope'], $this->scopeRepository)];
|
||||
}
|
||||
|
||||
public function describeAction($data, ExportGenerationContext $context): array
|
||||
{
|
||||
$scopes = [];
|
||||
|
||||
|
@@ -24,7 +24,11 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class CalendarForShortMessageProvider
|
||||
{
|
||||
public function __construct(private readonly CalendarRepository $calendarRepository, private readonly EntityManagerInterface $em, private readonly RangeGeneratorInterface $rangeGenerator) {}
|
||||
public function __construct(
|
||||
private readonly CalendarRepository $calendarRepository,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly RangeGeneratorInterface $rangeGenerator,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Generate calendars instance.
|
||||
|
@@ -21,7 +21,6 @@ namespace Chill\CalendarBundle\Tests\Service\ShortMessageNotification;
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||
use Chill\CalendarBundle\Service\ShortMessageNotification\CalendarForShortMessageProvider;
|
||||
use Chill\CalendarBundle\Service\ShortMessageNotification\DefaultRangeGenerator;
|
||||
use Chill\CalendarBundle\Service\ShortMessageNotification\RangeGeneratorInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -82,10 +81,16 @@ final class CalendarForShortMessageProviderTest extends TestCase
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->clear()->shouldBeCalled();
|
||||
|
||||
$calendarRangeGenerator = $this->prophesize(RangeGeneratorInterface::class);
|
||||
$calendarRangeGenerator->generateRange(Argument::any())->willReturn([
|
||||
'startDate' => new \DateTimeImmutable('yesterday'),
|
||||
'endDate' => new \DateTimeImmutable('now'),
|
||||
]);
|
||||
|
||||
$provider = new CalendarForShortMessageProvider(
|
||||
$calendarRepository->reveal(),
|
||||
$em->reveal(),
|
||||
new DefaultRangeGenerator()
|
||||
$calendarRangeGenerator->reveal(),
|
||||
);
|
||||
|
||||
$calendars = iterator_to_array($provider->getCalendars(new \DateTimeImmutable('now')));
|
||||
@@ -103,26 +108,32 @@ final class CalendarForShortMessageProviderTest extends TestCase
|
||||
Argument::type(\DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::exact(0)
|
||||
)->will(static fn ($args) => array_fill(0, 1, new Calendar()))->shouldBeCalledTimes(1);
|
||||
)->will(static fn ($args) => array_fill(0, 10, new Calendar()))->shouldBeCalledTimes(1);
|
||||
$calendarRepository->findByNotificationAvailable(
|
||||
Argument::type(\DateTimeImmutable::class),
|
||||
Argument::type(\DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::not(0)
|
||||
Argument::exact(10)
|
||||
)->will(static fn ($args) => [])->shouldBeCalledTimes(1);
|
||||
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->clear()->shouldBeCalled();
|
||||
|
||||
$calendarRangeGenerator = $this->prophesize(RangeGeneratorInterface::class);
|
||||
$calendarRangeGenerator->generateRange(Argument::any())->willReturn([
|
||||
'startDate' => new \DateTimeImmutable('yesterday'),
|
||||
'endDate' => new \DateTimeImmutable('now'),
|
||||
]);
|
||||
|
||||
$provider = new CalendarForShortMessageProvider(
|
||||
$calendarRepository->reveal(),
|
||||
$em->reveal(),
|
||||
new DefaultRangeGenerator()
|
||||
$calendarRangeGenerator->reveal(),
|
||||
);
|
||||
|
||||
$calendars = iterator_to_array($provider->getCalendars(new \DateTimeImmutable('now')));
|
||||
|
||||
$this->assertEquals(1, \count($calendars));
|
||||
$this->assertEquals(10, \count($calendars));
|
||||
$this->assertContainsOnly(Calendar::class, $calendars);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user