mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 16:55:00 +00:00
Compare commits
19 Commits
2.7.0
...
upgrade/sy
Author | SHA1 | Date | |
---|---|---|---|
13bc9683fb
|
|||
958e2b5cf2
|
|||
f7ed390c96
|
|||
217ce99851
|
|||
efaa01f4f6
|
|||
f04ef9c931
|
|||
9252e92da0
|
|||
4ab4554e63
|
|||
6d63177ff4
|
|||
81e8928344
|
|||
737f5f9275
|
|||
07c681fcec
|
|||
1c7d90a6ef
|
|||
24c33b306b
|
|||
7e19419861
|
|||
c35994203d
|
|||
9027cbd196
|
|||
dde3002100
|
|||
d8870e906f
|
35
.env.test
35
.env.test
@@ -3,3 +3,38 @@
|
|||||||
# Run tests from root to adapt your own environment
|
# Run tests from root to adapt your own environment
|
||||||
KERNEL_CLASS='App\Kernel'
|
KERNEL_CLASS='App\Kernel'
|
||||||
APP_SECRET='$ecretf0rt3st'
|
APP_SECRET='$ecretf0rt3st'
|
||||||
|
|
||||||
|
ADMIN_PASSWORD=admin
|
||||||
|
|
||||||
|
LOCALE=fr
|
||||||
|
REDIS_URL=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
||||||
|
|
||||||
|
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
|
||||||
|
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
|
||||||
|
JWT_PASSPHRASE=2a30f6ba26521a2613821da35f28386e
|
||||||
|
|
||||||
|
TWILIO_SID=~
|
||||||
|
TWILIO_SECRET=~
|
||||||
|
DEFAULT_CARRIER_CODE=BE
|
||||||
|
|
||||||
|
ADD_ADDRESS_DEFAULT_COUNTRY=BE
|
||||||
|
|
||||||
|
ADD_ADDRESS_MAP_CENTER_X=50.8443
|
||||||
|
ADD_ADDRESS_MAP_CENTER_Y=4.3523
|
||||||
|
ADD_ADDRESS_MAP_CENTER_Z=15
|
||||||
|
|
||||||
|
SHORT_MESSAGE_DSN=null://null
|
||||||
|
MESSENGER_TRANSPORT_DSN=sync://
|
||||||
|
###< symfony/messenger ###
|
||||||
|
|
||||||
|
###> doctrine/doctrine-bundle ###
|
||||||
|
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||||
|
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||||
|
#
|
||||||
|
DATABASE_URL="postgresql://postgres:postgres@db:5432/test?serverVersion=14&charset=utf8"
|
||||||
|
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_KEY=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
# Select what we should cache between builds
|
# Select what we should cache between builds
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- tests/app/vendor/
|
|
||||||
- .cache
|
- .cache
|
||||||
|
|
||||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||||
@@ -28,7 +27,7 @@ variables:
|
|||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
REDIS_URL: redis://redis:6379
|
REDIS_URL: redis://redis:6379
|
||||||
# change vendor dir to make the app install into tests/apps
|
# change vendor dir to make the app install into tests/apps
|
||||||
COMPOSER_VENDOR_DIR: tests/app/vendor
|
#COMPOSER_VENDOR_DIR: /vendor
|
||||||
DEFAULT_CARRIER_CODE: BE
|
DEFAULT_CARRIER_CODE: BE
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
@@ -49,7 +48,7 @@ build:
|
|||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- vendor/
|
||||||
|
|
||||||
code_style:
|
code_style:
|
||||||
stage: Tests
|
stage: Tests
|
||||||
@@ -63,7 +62,7 @@ code_style:
|
|||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- vendor/
|
||||||
|
|
||||||
phpstan_tests:
|
phpstan_tests:
|
||||||
stage: Tests
|
stage: Tests
|
||||||
@@ -77,7 +76,7 @@ phpstan_tests:
|
|||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- vendor/
|
||||||
|
|
||||||
rector_tests:
|
rector_tests:
|
||||||
stage: Tests
|
stage: Tests
|
||||||
@@ -91,7 +90,7 @@ rector_tests:
|
|||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- vendor/
|
||||||
|
|
||||||
# psalm_tests:
|
# psalm_tests:
|
||||||
# stage: Tests
|
# stage: Tests
|
||||||
@@ -111,13 +110,12 @@ unit_tests:
|
|||||||
# until we fix testes
|
# until we fix testes
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
script:
|
script:
|
||||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
- php tests/console doctrine:migrations:migrate -n
|
||||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
|
- php -d memory_limit=3G tests/console doctrine:fixtures:load -n
|
||||||
- php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n
|
- php -d memory_limit=2G tests/console cache:clear --env=test
|
||||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=test
|
|
||||||
- php -d memory_limit=4G bin/phpunit --colors=never
|
- php -d memory_limit=4G bin/phpunit --colors=never
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- vendor/
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
|||||||
[submodule "_exts/sphinx-php"]
|
[submodule "_exts/sphinx-php"]
|
||||||
path = _exts/sphinx-php
|
path = _exts/sphinx-php
|
||||||
url = https://github.com/fabpot/sphinx-php.git
|
url = https://github.com/fabpot/sphinx-php.git
|
||||||
[submodule "tests/app"]
|
|
||||||
path = tests/app
|
|
||||||
url = https://gitlab.com/Chill-projet/chill-app.git
|
|
||||||
|
@@ -107,7 +107,7 @@
|
|||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "tests/app/src/",
|
"App\\": "tests/",
|
||||||
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests",
|
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests",
|
||||||
"Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
|
"Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
|
||||||
}
|
}
|
||||||
@@ -123,12 +123,10 @@
|
|||||||
},
|
},
|
||||||
"bin-dir": "bin",
|
"bin-dir": "bin",
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"sort-packages": true,
|
"sort-packages": true
|
||||||
"vendor-dir": "tests/app/vendor"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"auto-scripts": {
|
"auto-scripts": {
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
|
||||||
"cache:clear": "symfony-cmd"
|
"cache:clear": "symfony-cmd"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,18 +50,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 readonly 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()
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="tests/app/vendor/phpunit/phpunit/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
bootstrap="tests/app/tests/bootstrap.php"
|
bootstrap="tests/bootstrap.php"
|
||||||
>
|
>
|
||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1" />
|
<ini name="error_reporting" value="-1" />
|
||||||
|
27
rector.php
27
rector.php
@@ -12,6 +12,8 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
__DIR__ . '/src',
|
__DIR__ . '/src',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/testsApp_KernelDevDebugContainer.xml');
|
||||||
|
|
||||||
//$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class);
|
//$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class);
|
||||||
//$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector');
|
//$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector');
|
||||||
|
|
||||||
@@ -21,7 +23,8 @@ 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_82,
|
||||||
|
\Rector\Symfony\Set\SymfonySetList::SYMFONY_44,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// skip some path...
|
// skip some path...
|
||||||
@@ -34,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
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
@@ -47,76 +47,29 @@ use function array_key_exists;
|
|||||||
|
|
||||||
final class ActivityController extends AbstractController
|
final class ActivityController extends AbstractController
|
||||||
{
|
{
|
||||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
|
||||||
|
|
||||||
private ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
|
||||||
|
|
||||||
private ActivityRepository $activityRepository;
|
|
||||||
|
|
||||||
private ActivityTypeCategoryRepository $activityTypeCategoryRepository;
|
|
||||||
|
|
||||||
private ActivityTypeRepositoryInterface $activityTypeRepository;
|
|
||||||
|
|
||||||
private CenterResolverManagerInterface $centerResolver;
|
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
private EventDispatcherInterface $eventDispatcher;
|
|
||||||
|
|
||||||
private LocationRepository $locationRepository;
|
|
||||||
|
|
||||||
private LoggerInterface $logger;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private SerializerInterface $serializer;
|
|
||||||
|
|
||||||
private ThirdPartyRepository $thirdPartyRepository;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
private UserRepositoryInterface $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||||
ActivityTypeRepositoryInterface $activityTypeRepository,
|
private readonly ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||||
ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
private readonly ActivityTypeCategoryRepository $activityTypeCategoryRepository,
|
||||||
PersonRepository $personRepository,
|
private readonly PersonRepository $personRepository,
|
||||||
ThirdPartyRepository $thirdPartyRepository,
|
private readonly ThirdPartyRepository $thirdPartyRepository,
|
||||||
LocationRepository $locationRepository,
|
private readonly LocationRepository $locationRepository,
|
||||||
ActivityRepository $activityRepository,
|
private readonly ActivityRepository $activityRepository,
|
||||||
AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository,
|
||||||
EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
private readonly EventDispatcherInterface $eventDispatcher,
|
||||||
LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
SerializerInterface $serializer,
|
private readonly SerializerInterface $serializer,
|
||||||
UserRepositoryInterface $userRepository,
|
private readonly UserRepositoryInterface $userRepository,
|
||||||
CenterResolverManagerInterface $centerResolver,
|
private readonly CenterResolverManagerInterface $centerResolver,
|
||||||
TranslatorInterface $translator
|
private readonly TranslatorInterface $translator,
|
||||||
) {
|
) {
|
||||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
|
||||||
$this->activityTypeRepository = $activityTypeRepository;
|
|
||||||
$this->activityTypeCategoryRepository = $activityTypeCategoryRepository;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
|
||||||
$this->locationRepository = $locationRepository;
|
|
||||||
$this->activityRepository = $activityRepository;
|
|
||||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
|
||||||
$this->entityManager = $entityManager;
|
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
|
||||||
$this->logger = $logger;
|
|
||||||
$this->serializer = $serializer;
|
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
$this->centerResolver = $centerResolver;
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 readonly 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 readonly EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->faker = FakerFactory::create('fr_FR');
|
$this->faker = FakerFactory::create('fr_FR');
|
||||||
$this->em = $em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
@@ -70,7 +67,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
->setPerson($person)
|
->setPerson($person)
|
||||||
->setDate($this->faker->dateTimeThisYear())
|
->setDate($this->faker->dateTimeThisYear())
|
||||||
->setDurationTime($this->faker->dateTime(36000))
|
->setDurationTime($this->faker->dateTime(36000))
|
||||||
->setType($this->getRandomActivityType())
|
->setActivityType($this->getRandomActivityType())
|
||||||
->setScope($this->getRandomScope());
|
->setScope($this->getRandomScope());
|
||||||
|
|
||||||
// ->setAttendee($this->faker->boolean())
|
// ->setAttendee($this->faker->boolean())
|
||||||
|
@@ -65,9 +65,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
use TrackUpdateTrait;
|
use TrackUpdateTrait;
|
||||||
|
|
||||||
public const SENTRECEIVED_RECEIVED = 'received';
|
final public const SENTRECEIVED_RECEIVED = 'received';
|
||||||
|
|
||||||
public const SENTRECEIVED_SENT = 'sent';
|
final public const SENTRECEIVED_SENT = 'sent';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||||
@@ -672,7 +672,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated use @link{self::setActivityType} instead
|
||||||
*/
|
*/
|
||||||
public function setType(ActivityType $activityType): self
|
public function setType(ActivityType $activityType): self
|
||||||
{
|
{
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,7 +21,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
|
||||||
@@ -65,7 +65,7 @@ class ActivityReasonCategory
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
return 'ActivityReasonCategory(' . $this->getName('x') . ')';
|
||||||
}
|
}
|
||||||
|
@@ -27,11 +27,11 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
*/
|
*/
|
||||||
class ActivityType
|
class ActivityType
|
||||||
{
|
{
|
||||||
public const FIELD_INVISIBLE = 0;
|
final public const FIELD_INVISIBLE = 0;
|
||||||
|
|
||||||
public const FIELD_OPTIONAL = 1;
|
final public const FIELD_OPTIONAL = 1;
|
||||||
|
|
||||||
public const FIELD_REQUIRED = 2;
|
final public const FIELD_REQUIRED = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated not in use
|
* @deprecated not in use
|
||||||
@@ -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 readonly EntityManagerInterface $em, private readonly 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 readonly UserRepositoryInterface $userRepository, private readonly 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 readonly SocialActionRender $actionRender, private readonly 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 readonly SocialIssueRepository $issueRepository, private readonly 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 readonly ThirdPartyRepository $thirdPartyRepository, private readonly 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 readonly ScopeRepository $scopeRepository, private readonly 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
|
||||||
|
@@ -29,12 +29,8 @@ class DateAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
private const DEFAULT_CHOICE = 'year';
|
private const DEFAULT_CHOICE = 'year';
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
public function __construct(private readonly TranslatorInterface $translator)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@@ -99,17 +95,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 readonly LocationTypeRepository $locationTypeRepository, private readonly 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
|
||||||
|
@@ -22,18 +22,10 @@ use function in_array;
|
|||||||
|
|
||||||
class ActivityTypeAggregator implements AggregatorInterface
|
class ActivityTypeAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
public const KEY = 'activity_type_aggregator';
|
final 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
|
||||||
|
@@ -21,18 +21,10 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class ActivityUserAggregator implements AggregatorInterface
|
class ActivityUserAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
public const KEY = 'activity_user_id';
|
final public const KEY = 'activity_user_id';
|
||||||
|
|
||||||
private UserRender $userRender;
|
public function __construct(private readonly UserRepository $userRepository, private readonly 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 readonly UserRepositoryInterface $userRepository, private readonly 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 readonly UserJobRepositoryInterface $userJobRepository, private readonly 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 readonly ScopeRepositoryInterface $scopeRepository, private readonly 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
|
||||||
@@ -113,21 +101,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 readonly TranslatorInterface $translator)
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
|
@@ -16,9 +16,9 @@ namespace Chill\ActivityBundle\Export;
|
|||||||
*/
|
*/
|
||||||
abstract class Declarations
|
abstract class Declarations
|
||||||
{
|
{
|
||||||
public const ACTIVITY = 'activity';
|
final public const ACTIVITY = 'activity';
|
||||||
|
|
||||||
public const ACTIVITY_ACP = 'activity_linked_to_acp';
|
final public const ACTIVITY_ACP = 'activity_linked_to_acp';
|
||||||
|
|
||||||
public const ACTIVITY_PERSON = 'activity_linked_to_person';
|
final public const ACTIVITY_PERSON = 'activity_linked_to_person';
|
||||||
}
|
}
|
||||||
|
@@ -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 readonly ListActivityHelper $helper, private readonly EntityManagerInterface $entityManager, private readonly 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)
|
||||||
@@ -62,22 +50,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'),
|
||||||
case 'scopesNames':
|
default => $this->helper->getLabels($key, $values, $data),
|
||||||
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 readonly 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)
|
||||||
|
@@ -30,24 +30,18 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
*/
|
*/
|
||||||
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
public const SUM = 'sum';
|
final 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 readonly 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)
|
||||||
|
@@ -30,46 +30,10 @@ use const SORT_NUMERIC;
|
|||||||
|
|
||||||
class ListActivityHelper
|
class ListActivityHelper
|
||||||
{
|
{
|
||||||
public const MSG_KEY = 'export.list.activity.';
|
final public const MSG_KEY = 'export.list.activity.';
|
||||||
|
|
||||||
private ActivityPresenceRepositoryInterface $activityPresenceRepository;
|
public function __construct(private readonly ActivityPresenceRepositoryInterface $activityPresenceRepository, private readonly ActivityTypeRepositoryInterface $activityTypeRepository, private readonly DateTimeHelper $dateTimeHelper, private readonly LabelPersonHelper $labelPersonHelper, private readonly LabelThirdPartyHelper $labelThirdPartyHelper, private readonly TranslatorInterface $translator, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatableStringExportLabelHelper $translatableStringLabelHelper, private readonly 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,113 +79,78 @@ 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) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'Attendee';
|
||||||
|
}
|
||||||
|
|
||||||
case 'createdBy':
|
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
|
||||||
case 'updatedBy':
|
return '';
|
||||||
return $this->userHelper->getLabel($key, $values, $key);
|
}
|
||||||
|
|
||||||
case 'date':
|
return $this->translatableStringHelper->localize($presence->getName());
|
||||||
return $this->dateTimeHelper->getLabel(self::MSG_KEY . $key);
|
},
|
||||||
|
'listReasons' => $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons'),
|
||||||
|
'typeName' => function ($value) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'Activity type';
|
||||||
|
}
|
||||||
|
|
||||||
case 'attendeeName':
|
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
|
||||||
return function ($value) {
|
return '';
|
||||||
if ('_header' === $value) {
|
}
|
||||||
return 'Attendee';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value || null === $presence = $this->activityPresenceRepository->find($value)) {
|
return $this->translatableStringHelper->localize($type->getName());
|
||||||
return '';
|
},
|
||||||
}
|
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
|
||||||
|
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return match ($key) {
|
||||||
|
'usersIds' => self::MSG_KEY . 'users ids',
|
||||||
|
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
|
||||||
|
'personsIds' => self::MSG_KEY . 'persons ids',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($presence->getName());
|
$decoded = json_decode($value, null, 512, JSON_THROW_ON_ERROR);
|
||||||
};
|
|
||||||
|
|
||||||
case 'listReasons':
|
return implode(
|
||||||
return $this->translatableStringLabelHelper->getLabelMulti($key, $values, 'Activity Reasons');
|
'|',
|
||||||
|
array_unique(
|
||||||
|
array_filter($decoded, static fn (?int $id) => null !== $id),
|
||||||
|
SORT_NUMERIC
|
||||||
|
)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
|
||||||
|
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
|
||||||
|
'sentReceived' => function ($value) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return self::MSG_KEY . 'sent received';
|
||||||
|
}
|
||||||
|
|
||||||
case 'typeName':
|
if (null === $value) {
|
||||||
return function ($value) {
|
return '';
|
||||||
if ('_header' === $value) {
|
}
|
||||||
return 'Activity type';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value || null === $type = $this->activityTypeRepository->find($value)) {
|
return $this->translator->trans($value);
|
||||||
return '';
|
},
|
||||||
}
|
default => function ($value) use ($key) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return self::MSG_KEY . $key;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($type->getName());
|
if (null === $value) {
|
||||||
};
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
case 'usersNames':
|
return $this->translator->trans($value);
|
||||||
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) {
|
|
||||||
switch ($key) {
|
|
||||||
case 'usersIds':
|
|
||||||
return self::MSG_KEY . 'users 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);
|
|
||||||
|
|
||||||
return implode(
|
|
||||||
'|',
|
|
||||||
array_unique(
|
|
||||||
array_filter($decoded, static fn (?int $id) => null !== $id),
|
|
||||||
SORT_NUMERIC
|
|
||||||
)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
case 'personsNames':
|
|
||||||
return $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name');
|
|
||||||
|
|
||||||
case 'thirdPartiesNames':
|
|
||||||
return $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties');
|
|
||||||
|
|
||||||
case 'sentReceived':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return self::MSG_KEY . 'sent received';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->translator->trans($value);
|
|
||||||
};
|
|
||||||
|
|
||||||
default:
|
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return self::MSG_KEY . $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
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 readonly ActivityTypeRepositoryInterface $activityTypeRepository, private readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly ScopeRepositoryInterface $scopeRepository, private readonly 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 readonly 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 readonly ActivityReasonRepository $activityReasonRepository, private readonly ActivityReasonRender $reasonRender, private readonly 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 readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly 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)
|
||||||
|
@@ -18,13 +18,10 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
/**
|
/**
|
||||||
* @implements LocalMenuBuilderInterface<array>
|
* @implements LocalMenuBuilderInterface<array>
|
||||||
*/
|
*/
|
||||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
final readonly 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(protected AuthorizationCheckerInterface $authorizationChecker, protected TranslatorInterface $translator)
|
||||||
* @var AuthorizationCheckerInterface
|
{
|
||||||
*/
|
|
||||||
protected $authorizationChecker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
protected $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)
|
||||||
|
@@ -16,13 +16,10 @@ use Chill\ActivityBundle\Repository\ActivityRepository;
|
|||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
||||||
|
|
||||||
final class ActivityNotificationHandler implements NotificationHandlerInterface
|
final readonly 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
|
||||||
|
@@ -33,34 +33,10 @@ use Symfony\Component\Security\Core\Security;
|
|||||||
use function count;
|
use function count;
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
||||||
{
|
{
|
||||||
private AuthorizationHelper $authorizationHelper;
|
public function __construct(private AuthorizationHelper $authorizationHelper, private CenterResolverDispatcherInterface $centerResolverDispatcher, private TokenStorageInterface $tokenStorage, private ActivityRepository $repository, private EntityManagerInterface $em, private Security $security)
|
||||||
|
{
|
||||||
private CenterResolverDispatcherInterface $centerResolverDispatcher;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ActivityRepository $repository;
|
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
private TokenStorageInterface $tokenStorage;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
AuthorizationHelper $authorizationHelper,
|
|
||||||
CenterResolverDispatcherInterface $centerResolverDispatcher,
|
|
||||||
TokenStorageInterface $tokenStorage,
|
|
||||||
ActivityRepository $repository,
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
Security $security
|
|
||||||
) {
|
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
|
||||||
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
|
||||||
$this->tokenStorage = $tokenStorage;
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
||||||
|
@@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository;
|
|||||||
|
|
||||||
class ActivityPresenceRepository implements ActivityPresenceRepositoryInterface
|
class ActivityPresenceRepository implements ActivityPresenceRepositoryInterface
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private readonly EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager)
|
public function __construct(EntityManagerInterface $entityManager)
|
||||||
{
|
{
|
||||||
|
@@ -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 readonly RequestStack $requestStack
|
||||||
) {
|
) {
|
||||||
parent::__construct($registry, ActivityReason::class);
|
parent::__construct($registry, ActivityReason::class);
|
||||||
|
|
||||||
$this->requestStack = $requestStack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -17,7 +17,7 @@ use Doctrine\ORM\EntityRepository;
|
|||||||
|
|
||||||
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
final class ActivityTypeRepository implements ActivityTypeRepositoryInterface
|
||||||
{
|
{
|
||||||
private EntityRepository $repository;
|
private readonly EntityRepository $repository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
|
@@ -20,9 +20,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|||||||
|
|
||||||
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||||
{
|
{
|
||||||
public const LISTS = 'CHILL_ACTIVITY_LIST';
|
final public const LISTS = 'CHILL_ACTIVITY_LIST';
|
||||||
|
|
||||||
public const STATS = 'CHILL_ACTIVITY_STATS';
|
final public const STATS = 'CHILL_ACTIVITY_STATS';
|
||||||
|
|
||||||
protected VoterHelperInterface $helper;
|
protected VoterHelperInterface $helper;
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
*
|
*
|
||||||
* It is safe for usage in template and controller
|
* It is safe for usage in template and controller
|
||||||
*/
|
*/
|
||||||
public const CREATE = 'CHILL_ACTIVITY_CREATE';
|
final public const CREATE = 'CHILL_ACTIVITY_CREATE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* role to allow to create an activity associated win an accompanying course.
|
* role to allow to create an activity associated win an accompanying course.
|
||||||
@@ -44,7 +44,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public const CREATE_ACCOMPANYING_COURSE = 'CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE';
|
final public const CREATE_ACCOMPANYING_COURSE = 'CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* role to allow to create an activity associated with a person.
|
* role to allow to create an activity associated with a person.
|
||||||
@@ -53,17 +53,17 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public const CREATE_PERSON = 'CHILL_ACTIVITY_CREATE_PERSON';
|
final public const CREATE_PERSON = 'CHILL_ACTIVITY_CREATE_PERSON';
|
||||||
|
|
||||||
public const DELETE = 'CHILL_ACTIVITY_DELETE';
|
final public const DELETE = 'CHILL_ACTIVITY_DELETE';
|
||||||
|
|
||||||
public const FULL = 'CHILL_ACTIVITY_FULL';
|
final public const FULL = 'CHILL_ACTIVITY_FULL';
|
||||||
|
|
||||||
public const SEE = 'CHILL_ACTIVITY_SEE';
|
final public const SEE = 'CHILL_ACTIVITY_SEE';
|
||||||
|
|
||||||
public const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS';
|
final public const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS';
|
||||||
|
|
||||||
public const UPDATE = 'CHILL_ACTIVITY_UPDATE';
|
final public const UPDATE = 'CHILL_ACTIVITY_UPDATE';
|
||||||
|
|
||||||
private const ALL = [
|
private const ALL = [
|
||||||
self::CREATE,
|
self::CREATE,
|
||||||
@@ -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])
|
||||||
|
@@ -39,40 +39,8 @@ class ActivityContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private BaseContextData $baseContextData;
|
public function __construct(private readonly DocumentCategoryRepository $documentCategoryRepository, private readonly NormalizerInterface $normalizer, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly EntityManagerInterface $em, private readonly PersonRenderInterface $personRender, private readonly PersonRepository $personRepository, private readonly TranslatorInterface $translator, private readonly BaseContextData $baseContextData)
|
||||||
|
{
|
||||||
private DocumentCategoryRepository $documentCategoryRepository;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
|
||||||
|
|
||||||
private PersonRenderInterface $personRender;
|
|
||||||
|
|
||||||
private PersonRepository $personRepository;
|
|
||||||
|
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
DocumentCategoryRepository $documentCategoryRepository,
|
|
||||||
NormalizerInterface $normalizer,
|
|
||||||
TranslatableStringHelperInterface $translatableStringHelper,
|
|
||||||
EntityManagerInterface $em,
|
|
||||||
PersonRenderInterface $personRender,
|
|
||||||
PersonRepository $personRepository,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
BaseContextData $baseContextData
|
|
||||||
) {
|
|
||||||
$this->documentCategoryRepository = $documentCategoryRepository;
|
|
||||||
$this->normalizer = $normalizer;
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
$this->em = $em;
|
|
||||||
$this->personRender = $personRender;
|
|
||||||
$this->personRepository = $personRepository;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->baseContextData = $baseContextData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 readonly AccompanyingPeriodContext $accompanyingPeriodContext, private readonly ActivityACLAwareRepositoryInterface $activityACLAwareRepository, private readonly NormalizerInterface $normalizer, private readonly PersonRepository $personRepository, private readonly SocialActionRepository $socialActionRepository, private readonly SocialIssueRepository $socialIssueRepository, private readonly ThirdPartyRepository $thirdPartyRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly 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
|
||||||
|
@@ -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();
|
||||||
|
|
||||||
@@ -216,7 +214,7 @@ final class ActivityControllerTest extends WebTestCase
|
|||||||
->setName('social without activity');
|
->setName('social without activity');
|
||||||
//copy role scopes where ACTIVITY is not present
|
//copy role scopes where ACTIVITY is not present
|
||||||
foreach ($socialPermissionGroup->getRoleScopes() as $roleScope) {
|
foreach ($socialPermissionGroup->getRoleScopes() as $roleScope) {
|
||||||
if (!strpos($roleScope->getRole(), 'ACTIVITY')) {
|
if (!strpos((string) $roleScope->getRole(), 'ACTIVITY')) {
|
||||||
$withoutActivityPermissionGroup->addRoleScope($roleScope);
|
$withoutActivityPermissionGroup->addRoleScope($roleScope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,
|
||||||
|
@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|||||||
*/
|
*/
|
||||||
final class ActivityReasonCategoryControllerTest extends WebTestCase
|
final class ActivityReasonCategoryControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testToWrite()
|
public function testToWrite(): never
|
||||||
{
|
{
|
||||||
$this->markTestSkipped();
|
$this->markTestSkipped();
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|||||||
*/
|
*/
|
||||||
final class ActivityReasonControllerTest extends WebTestCase
|
final class ActivityReasonControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testToWrite()
|
public function testToWrite(): never
|
||||||
{
|
{
|
||||||
$this->markTestSkipped();
|
$this->markTestSkipped();
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|||||||
*/
|
*/
|
||||||
final class ActivityTypeControllerTest extends WebTestCase
|
final class ActivityTypeControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testToWrite()
|
public function testToWrite(): never
|
||||||
{
|
{
|
||||||
$this->markTestSkipped();
|
$this->markTestSkipped();
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSimple()
|
public function testSimple(): never
|
||||||
{
|
{
|
||||||
$translatableActivityReasonType = new PickActivityReasonType(
|
$translatableActivityReasonType = new PickActivityReasonType(
|
||||||
$this->getTranslatableStringHelper()
|
$this->getTranslatableStringHelper()
|
||||||
|
@@ -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)
|
||||||
|
@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|||||||
*/
|
*/
|
||||||
final class TimelineProviderTest extends WebTestCase
|
final class TimelineProviderTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testAnActivityIsShownOnTimeline()
|
public function testAnActivityIsShownOnTimeline(): never
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('we have to write fixtures before writing this tests');
|
$this->markTestSkipped('we have to write fixtures before writing this tests');
|
||||||
}
|
}
|
||||||
|
@@ -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 !');
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,9 @@ use Symfony\Component\Validator\Constraint;
|
|||||||
*/
|
*/
|
||||||
class ActivityValidity extends Constraint
|
class ActivityValidity extends Constraint
|
||||||
{
|
{
|
||||||
public const IS_REQUIRED_MESSAGE = ' is required';
|
final public const IS_REQUIRED_MESSAGE = ' is required';
|
||||||
|
|
||||||
public const ROOT_MESSAGE = 'For this type of activity, ';
|
final public const ROOT_MESSAGE = 'For this type of activity, ';
|
||||||
|
|
||||||
public $noPersonsMessage = 'For this type of activity, you must add at least one person';
|
public $noPersonsMessage = 'For this type of activity, you must add at least one person';
|
||||||
|
|
||||||
|
@@ -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 readonly 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 readonly UserRepository $userRepository)
|
||||||
|
|
||||||
public function __construct(UserRepository $userRepository)
|
|
||||||
{
|
{
|
||||||
$this->userRepository = $userRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDependencies(): array
|
public function getDependencies(): array
|
||||||
|
@@ -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 readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, private readonly 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 readonly UserJobRepositoryInterface $userJobRepository, private readonly 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 readonly ScopeRepositoryInterface $scopeRepository, private readonly 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
|
||||||
|
@@ -16,5 +16,5 @@ namespace Chill\AsideActivityBundle\Export;
|
|||||||
*/
|
*/
|
||||||
abstract class Declarations
|
abstract class Declarations
|
||||||
{
|
{
|
||||||
public const ASIDE_ACTIVITY_TYPE = 'aside_activity';
|
final public const ASIDE_ACTIVITY_TYPE = 'aside_activity';
|
||||||
}
|
}
|
||||||
|
@@ -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 readonly 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 readonly AsideActivityRepository $repository)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
AsideActivityRepository $repository
|
|
||||||
) {
|
|
||||||
$this->repository = $repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
@@ -32,42 +32,10 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
use LogicException;
|
use LogicException;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
final readonly 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)
|
||||||
@@ -91,86 +59,67 @@ 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':
|
if ('_header' === $value) {
|
||||||
return static function ($value) use ($key) {
|
return 'export.aside_activity.' . $key;
|
||||||
if ('_header' === $value) {
|
}
|
||||||
return 'export.aside_activity.' . $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value ?? '';
|
return $value ?? '';
|
||||||
};
|
},
|
||||||
|
'duration' => static function ($value) use ($key) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'export.aside_activity.' . $key;
|
||||||
|
}
|
||||||
|
|
||||||
case 'duration':
|
if (null === $value) {
|
||||||
return static function ($value) use ($key) {
|
return '';
|
||||||
if ('_header' === $value) {
|
}
|
||||||
return 'export.aside_activity.' . $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value) {
|
if ($value instanceof DateTimeInterface) {
|
||||||
return '';
|
return $value->format('H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value instanceof DateTimeInterface) {
|
return $value;
|
||||||
return $value->format('H:i:s');
|
},
|
||||||
}
|
'createdAt', 'updatedAt', 'date' => $this->dateTimeHelper->getLabel('export.aside_activity.' . $key),
|
||||||
|
'agent_id', 'creator_id' => $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key),
|
||||||
|
'aside_activity_type' => function ($value) {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'export.aside_activity.aside_activity_type';
|
||||||
|
}
|
||||||
|
|
||||||
return $value;
|
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
|
||||||
};
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
case 'createdAt':
|
return $this->categoryRender->renderString($c, []);
|
||||||
case 'updatedAt':
|
},
|
||||||
case 'date':
|
'main_scope' => function ($value) {
|
||||||
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
|
if ('_header' === $value) {
|
||||||
|
return 'export.aside_activity.main_scope';
|
||||||
|
}
|
||||||
|
|
||||||
case 'agent_id':
|
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
|
||||||
case 'creator_id':
|
return '';
|
||||||
return $this->userHelper->getLabel($key, $values, 'export.aside_activity.' . $key);
|
}
|
||||||
|
|
||||||
case 'aside_activity_type':
|
return $this->translatableStringHelper->localize($c->getName());
|
||||||
return function ($value) {
|
},
|
||||||
if ('_header' === $value) {
|
'main_center' => function ($value) {
|
||||||
return 'export.aside_activity.aside_activity_type';
|
if ('_header' === $value) {
|
||||||
}
|
return 'export.aside_activity.main_center';
|
||||||
|
}
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $c = $this->asideActivityCategoryRepository->find($value)) {
|
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
||||||
return '';
|
/** @var Center $c */
|
||||||
}
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->categoryRender->renderString($c, []);
|
return $c->getName();
|
||||||
};
|
},
|
||||||
|
default => throw new LogicException('this key is not supported : ' . $key),
|
||||||
case 'main_scope':
|
};
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'export.aside_activity.main_scope';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $c = $this->scopeRepository->find($value)) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($c->getName());
|
|
||||||
};
|
|
||||||
|
|
||||||
case 'main_center':
|
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
|
||||||
return 'export.aside_activity.main_center';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
|
||||||
/** @var Center $c */
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $c->getName();
|
|
||||||
};
|
|
||||||
|
|
||||||
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 readonly 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 readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly 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 readonly 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 readonly 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 readonly 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 readonly ScopeRepositoryInterface $scopeRepository, private readonly 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 readonly CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@@ -33,7 +33,7 @@ use function in_array;
|
|||||||
|
|
||||||
final class AsideActivityFormType extends AbstractType
|
final class AsideActivityFormType extends AbstractType
|
||||||
{
|
{
|
||||||
private array $timeChoices;
|
private readonly array $timeChoices;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ParameterBagInterface $parameterBag,
|
ParameterBagInterface $parameterBag,
|
||||||
@@ -105,13 +105,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
if (!in_array($data->getTimestamp(), $timeChoices, true)) {
|
if (!in_array($data->getTimestamp(), $timeChoices, true)) {
|
||||||
// the data are not in the possible values. add them
|
// the data are not in the possible values. add them
|
||||||
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
|
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
|
||||||
$form = $builder->create($fieldName, ChoiceType::class, array_merge(
|
$form = $builder->create($fieldName, ChoiceType::class, [...$durationTimeOptions, 'choices' => $timeChoices, 'auto_initialize' => false]);
|
||||||
$durationTimeOptions,
|
|
||||||
[
|
|
||||||
'choices' => $timeChoices,
|
|
||||||
'auto_initialize' => false,
|
|
||||||
]
|
|
||||||
));
|
|
||||||
$form->addModelTransformer($durationTimeTransformer);
|
$form->addModelTransformer($durationTimeTransformer);
|
||||||
$formEvent->getForm()->getParent()->add($form->getForm());
|
$formEvent->getForm()->getParent()->add($form->getForm());
|
||||||
}
|
}
|
||||||
|
@@ -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 readonly CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
public function __construct(
|
|
||||||
CategoryRender $categoryRender
|
|
||||||
) {
|
|
||||||
$this->categoryRender = $categoryRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@@ -14,13 +14,10 @@ namespace Chill\AsideActivityBundle\Menu;
|
|||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
final readonly 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user