mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix conflicts when merging master
This commit is contained in:
commit
52f817bde7
@ -60,7 +60,7 @@ code_style:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
sa_tests:
|
||||
phpstan_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
@ -71,6 +71,17 @@ sa_tests:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
psalm_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
script:
|
||||
- bin/grumphp run --tasks=psalm
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
- bin
|
||||
- tests/app/vendor/
|
||||
|
||||
unit_tests:
|
||||
stage: Tests
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
@ -79,7 +90,7 @@ unit_tests:
|
||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
|
||||
- php -d memory_limit=3G tests/app/bin/console doctrine:fixtures:load -n
|
||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=test
|
||||
- php -d memory_limit=3G bin/phpunit --colors=never
|
||||
- php -d memory_limit=4G bin/phpunit --colors=never
|
||||
artifacts:
|
||||
expire_in: 30 min
|
||||
paths:
|
||||
|
46
CHANGELOG.md
46
CHANGELOG.md
@ -18,12 +18,46 @@ and this project adheres to
|
||||
* [household] household member editor: display alert if some members have already an household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#172)
|
||||
* [household] household member editor: do not add in new members if the member is included in the members of household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#123)
|
||||
* [household] household member editor: remove markNoAddress button (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109)
|
||||
* [person]: ordering fields in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61)
|
||||
* [person]: Add email and alt names in add person (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/61)
|
||||
* AddAddress: optimize loading: wait for the user finish typing;
|
||||
* UserPicker: fix bug with deprecated role
|
||||
* docgen: add base context + tests
|
||||
* docgen: add age for person
|
||||
* [household menu] fix filiation order https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/265
|
||||
* [AddAddress]: optimize loading: wait for the user finish typing;
|
||||
* [UserPicker]: fix bug with deprecated role
|
||||
* [docgen]: add base context + tests
|
||||
* [docgen]: add age for person
|
||||
* [task]: fix dropdown menu style + fix bug in singleTaskController (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/338)
|
||||
* Household: fix bug when moving person on the same day (see https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/281)
|
||||
* Household: show date validFrom and validTo when moving
|
||||
* address reference: add index for refid
|
||||
* [accompanyingCourse_work] fix styles conflicts + fix bug with remove goal (remove goals one at a time)
|
||||
|
||||
## Test releases
|
||||
|
||||
### test release 2021-12-14
|
||||
|
||||
* [asideactivity] creation of aside activity category fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/262)
|
||||
* [vendee/person] fix typo "situation professionelle" => "situation professionnelle"
|
||||
* [main] add availableForUsers condition from locationType in the location API endpoint (champs-libres/departement-de-la-vendee/accent-suivi-developpement#248)
|
||||
* [main] add the current location of the user as API point + add it in the activity location list (champs-libres/departement-de-la-vendee/accent-suivi-developpement#247)
|
||||
* [activity] improve show/new/edit templates, fix SEE and SEE_DETAILS acl
|
||||
* [badges] create specific badge for TMS, and make person/thirdparty badges clickable with on-the-fly modal in :
|
||||
* concerned groups items (activity, calendar)
|
||||
* accompanyingCourseWork lists
|
||||
* accompanyingCourse lists
|
||||
* [acompanyingCourse] add initial comment on Resume page
|
||||
* [person] create button full width (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/330)
|
||||
|
||||
### test release 2021-12-11
|
||||
|
||||
* [main] add order field to civility
|
||||
* [main] change address format in case the country is France, in Address render box and address normalizer
|
||||
* [person] add validator for accompanying period with a test on social issues (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/76)
|
||||
* [activity] fix visibility for location
|
||||
* [origin] fix origin: use correctly the translatable strings
|
||||
|
||||
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
|
||||
* [person] redirect bug fixed.
|
||||
* [action] add an unrelated issue within action creation.
|
||||
@ -36,8 +70,10 @@ and this project adheres to
|
||||
* [person] show acceptSMS option (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [person] add death information in person render box in twig and vue render boxes (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
|
||||
* [asideactivity] creation of aside activity category fixed (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/262)
|
||||
|
||||
## Test releases
|
||||
* [vendee/person] fix typo "situation professionelle" => "situation professionnelle"
|
||||
* [accompanyingcourse_work] Changes in layout/behavior of edit form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/321)
|
||||
* [badge-entity] design coherency between pills badge-person and 3 kinds of badge-thirdparty
|
||||
* [AddPersons] suggestions row are clickable, not only checkbox
|
||||
|
||||
### test release 2021-12-06
|
||||
|
||||
@ -54,10 +90,6 @@ and this project adheres to
|
||||
* [visgraph] improve and fix bugs on vis-network relationship graph
|
||||
* [bugfix] posting of birth- and deathdate through api fixed.
|
||||
* [suggestions] improve suggestions lists
|
||||
* [badge-entity] design coherency between badge-person and 3 kinds of badge-thirdparty
|
||||
* [AddPersons] suggestions row are clickable, not only checkbox
|
||||
* [activity] improve show/new/edit templates, fix SEE and SEE_DETAILS acl
|
||||
* [activity][calendar] concerned groups items are clickable with on-the-fly modal, create specific badge for TMS column
|
||||
|
||||
### Test release 2021-11-19 - bis
|
||||
|
||||
|
@ -397,7 +397,6 @@ Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'an
|
||||
<li>
|
||||
<span>
|
||||
item
|
||||
<a></a>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@ -405,8 +404,8 @@ Créer une liste de suggestions à enlever (avec une croix rouge cliquable, l'an
|
||||
Créer un titre enlevable (avec une croix rouge cliquable, l'ancre a est vide)
|
||||
```html
|
||||
<div class="item-title">
|
||||
title
|
||||
<a></a>
|
||||
<span>title</span>
|
||||
</div>
|
||||
```
|
||||
Les classes `cols` ou `inline` peuvent être ajoutées à côté de `list-suggest` pour modifier la disposition de la liste.
|
||||
Dans le dernier exemple, on met une classe `removable` sur le span, si on veut pouvoir enlever l'élément.
|
||||
|
@ -1,55 +1,53 @@
|
||||
{
|
||||
"name": "chill-project/chill-bundles",
|
||||
"type": "library",
|
||||
"description": "Most used bundles for chill-project",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"chill",
|
||||
"social worker"
|
||||
],
|
||||
"license": "AGPL-3.0-only",
|
||||
"require": {
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||
"champs-libres/wopi-bundle": "dev-master",
|
||||
"composer/package-versions-deprecated": "^1.10",
|
||||
"php": "^7.4",
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4#d57134aee8e504a83c902ff0cf9f8d36ac418290",
|
||||
"champs-libres/wopi-bundle": "dev-master#59b468503b9413f8d588ef9e626e7675560db3d8",
|
||||
"champs-libres/wopi-lib": "dev-master#0e1da19bb6de820080b8651867a7e475be590060",
|
||||
"doctrine/doctrine-bundle": "^2.1",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||
"doctrine/orm": "^2.7",
|
||||
"erusev/parsedown": "^1.7",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"knplabs/knp-menu": "^3.1",
|
||||
"knplabs/knp-menu-bundle": "^3.0",
|
||||
"knplabs/knp-time-bundle": "^1.12",
|
||||
"league/csv": "^9.7.1",
|
||||
"nyholm/psr7": "^1.4",
|
||||
"ocramius/package-versions": "^1.10",
|
||||
"phpoffice/phpspreadsheet": "^1.16",
|
||||
"ramsey/uuid-doctrine": "^1.7",
|
||||
"sensio/framework-extra-bundle": "^5.5",
|
||||
"spomky-labs/base64url": "^2.0",
|
||||
"symfony/asset": "4.*",
|
||||
"symfony/browser-kit": "^5.2",
|
||||
"symfony/css-selector": "^5.2",
|
||||
"symfony/expression-language": "4.*",
|
||||
"symfony/form": "4.*",
|
||||
"symfony/intl": "4.*",
|
||||
"symfony/mime": "^4 || ^5",
|
||||
"symfony/asset": "^4.4",
|
||||
"symfony/browser-kit": "^4.4",
|
||||
"symfony/css-selector": "^4.4",
|
||||
"symfony/expression-language": "^4.4",
|
||||
"symfony/form": "^4.4",
|
||||
"symfony/framework-bundle": "^4.4",
|
||||
"symfony/intl": "^4.4",
|
||||
"symfony/mime": "^4.4",
|
||||
"symfony/monolog-bundle": "^3.5",
|
||||
"symfony/security-bundle": "4.*",
|
||||
"symfony/serializer": "^5.2",
|
||||
"symfony/security-bundle": "^4.4",
|
||||
"symfony/serializer": "^5.3",
|
||||
"symfony/swiftmailer-bundle": "^3.5",
|
||||
"symfony/templating": "4.*",
|
||||
"symfony/translation": "4.*",
|
||||
"symfony/templating": "^4.4",
|
||||
"symfony/translation": "^4.4",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"symfony/validator": "4.*",
|
||||
"symfony/validator": "^4.4",
|
||||
"symfony/webpack-encore-bundle": "^1.11",
|
||||
"symfony/workflow": "4.*",
|
||||
"symfony/yaml": "4.*",
|
||||
"twig/extra-bundle": "^2.12 || ^3.0",
|
||||
"symfony/workflow": "^4.4",
|
||||
"symfony/yaml": "^4.4",
|
||||
"twig/extra-bundle": "^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.3",
|
||||
"twig/twig": "^2.12 || ^3.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
"twig/markdown-extra": "^3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||
@ -57,18 +55,17 @@
|
||||
"fakerphp/faker": "^1.13",
|
||||
"nelmio/alice": "^3.8",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"phpunit/phpunit": ">= 7.5",
|
||||
"symfony/debug-bundle": "^5.1",
|
||||
"symfony/dotenv": "^5.1",
|
||||
"symfony/dotenv": "^4.4",
|
||||
"symfony/maker-bundle": "^1.20",
|
||||
"symfony/phpunit-bridge": "^5.2",
|
||||
"symfony/stopwatch": "^5.1",
|
||||
"symfony/var-dumper": "4.*",
|
||||
"symfony/web-profiler-bundle": "^5.0"
|
||||
"symfony/phpunit-bridge": "^4.4",
|
||||
"symfony/stopwatch": "^4.4",
|
||||
"symfony/var-dumper": "^4.4",
|
||||
"symfony/web-profiler-bundle": "^4.4"
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"vendor-dir": "tests/app/vendor"
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@ -95,8 +92,19 @@
|
||||
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true,
|
||||
"phpstan/extension-installer": true,
|
||||
"ergebnis/composer-normalize": true,
|
||||
"phpro/grumphp": true,
|
||||
"ocramius/package-versions": true
|
||||
},
|
||||
"bin-dir": "bin",
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"vendor-dir": "tests/app/vendor"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
|
@ -91,7 +91,9 @@ class CountPerson implements ExportInterface
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
// we gather all center the user choose.
|
||||
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
$qb = $this->entityManager->createQueryBuilder();
|
||||
|
||||
|
25
grumphp.yml
25
grumphp.yml
@ -12,3 +12,28 @@ parameters:
|
||||
tasks.phpcsfixer.allow_risky: true
|
||||
tasks.phpcsfixer.diff: true
|
||||
tasks.phpstan.level: 1
|
||||
tasks.phpstan.blocking: true
|
||||
tasks.phpstan.ignore_patterns:
|
||||
- "/.github/"
|
||||
- "/.idea/"
|
||||
- "/build/"
|
||||
- "/benchmarks/"
|
||||
- "/docs/"
|
||||
- "/node_modules/"
|
||||
- "/resource/"
|
||||
- "/spec/"
|
||||
- "/var/"
|
||||
- "/vendor/"
|
||||
|
||||
# Psalm
|
||||
tasks.psalm.blocking: true
|
||||
tasks.psalm.ignore_patterns:
|
||||
- "/.github/"
|
||||
- "/.idea/"
|
||||
- "/build/"
|
||||
- "/benchmarks/"
|
||||
- "/node_modules/"
|
||||
- "/resource/"
|
||||
- "/spec/"
|
||||
- "/var/"
|
||||
- "/vendor/"
|
||||
|
@ -417,15 +417,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
||||
|
||||
-
|
||||
message:
|
||||
"""
|
||||
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 3
|
||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
||||
|
||||
-
|
||||
message:
|
||||
"""
|
||||
@ -435,15 +426,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
|
||||
|
||||
-
|
||||
message:
|
||||
"""
|
||||
#^Fetching class constant class of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
|
||||
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
|
||||
"""
|
||||
count: 1
|
||||
path: src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
|
||||
|
||||
-
|
||||
message:
|
||||
"""
|
||||
@ -877,11 +859,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverEvent.php
|
||||
|
||||
-
|
||||
message: "#^Call to deprecated method setTimeout\\(\\) of class Redis\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/PasswordRecover/PasswordRecoverLocker.php
|
||||
|
||||
-
|
||||
message:
|
||||
"""
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="tests/app/vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/app/tests/bootstrap.php"
|
||||
stopOnFailure="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
|
2006
psalm-baseline.xml
Normal file
2006
psalm-baseline.xml
Normal file
File diff suppressed because it is too large
Load Diff
16
psalm.xml
Normal file
16
psalm.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="7"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config tests/app/vendor/vimeo/psalm/config.xsd"
|
||||
errorBaseline="psalm-baseline.xml"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="./tests/" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
@ -39,6 +39,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
final class ActivityController extends AbstractController
|
||||
@ -307,8 +308,10 @@ final class ActivityController extends AbstractController
|
||||
$activityData = $request->query->get('activityData');
|
||||
}
|
||||
|
||||
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|
||||
|| !$activityType->isActive()) {
|
||||
if (
|
||||
!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|
||||
|| !$activityType->isActive()
|
||||
) {
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
||||
if (null !== $activityData) {
|
||||
|
@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Controller;
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Controller;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Form\ActivityReasonType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@ -19,6 +19,7 @@ use Chill\MainBundle\Entity\RoleScope;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
use function is_int;
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
|
@ -27,6 +27,7 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
@ -189,7 +190,9 @@ class ListActivity implements ListInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
// throw an error if any fields are present
|
||||
if (!array_key_exists('fields', $data)) {
|
||||
|
@ -25,6 +25,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
|
@ -24,6 +24,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
|
@ -31,6 +31,7 @@ use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
|
@ -48,6 +48,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
|
@ -36,8 +36,10 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
$period = $parameters['accompanyingCourse'];
|
||||
|
||||
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
|
||||
&& $this->security->isGranted(ActivityVoter::SEE, $period)) {
|
||||
if (
|
||||
AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
|
||||
&& $this->security->isGranted(ActivityVoter::SEE, $period)
|
||||
) {
|
||||
$menu->addChild($this->translator->trans('Activity'), [
|
||||
'route' => 'chill_activity_activity_list',
|
||||
'routeParameters' => [
|
||||
|
@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Menu;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
@ -22,6 +22,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
@ -167,7 +168,9 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
|
||||
// we get the ids for those scopes
|
||||
$reachablesScopesId = array_map(
|
||||
static function (Scope $scope) { return $scope->getId(); },
|
||||
static function (Scope $scope) {
|
||||
return $scope->getId();
|
||||
},
|
||||
$reachableScopes
|
||||
);
|
||||
|
||||
|
@ -17,6 +17,14 @@ const getLocations = () => fetchResults('/api/1.0/main/location.json');
|
||||
|
||||
const getLocationTypes = () => fetchResults('/api/1.0/main/location-type.json');
|
||||
|
||||
const getUserCurrentLocation =
|
||||
() => fetch('/api/1.0/main/user-current-location.json')
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* Load Location Type by defaultFor
|
||||
* @param {string} entity - can be "person" or "thirdparty"
|
||||
@ -48,5 +56,6 @@ export {
|
||||
getLocations,
|
||||
getLocationTypes,
|
||||
getLocationTypeByDefaultFor,
|
||||
postLocation
|
||||
postLocation,
|
||||
getUserCurrentLocation
|
||||
};
|
||||
|
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<li>
|
||||
<span :title="person.text">
|
||||
<span class="chill_denomination">{{ textCutted }}</span>
|
||||
<a @click.prevent="$emit('remove', person)"></a>
|
||||
<span class="chill_denomination" @click.prevent="$emit('remove', person)">{{ textCutted }}</span>
|
||||
</span>
|
||||
</li>
|
||||
</template>
|
||||
|
@ -15,7 +15,7 @@
|
||||
:searchable="true"
|
||||
:placeholder="$t('activity.choose_location')"
|
||||
:custom-label="customLabel"
|
||||
:options="locations"
|
||||
:options="availableLocations"
|
||||
group-values="locations"
|
||||
group-label="locationGroup"
|
||||
v-model="location"
|
||||
@ -32,7 +32,7 @@
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import VueMultiselect from "vue-multiselect";
|
||||
import NewLocation from "./Location/NewLocation.vue";
|
||||
import { getLocations, getLocationTypeByDefaultFor } from "../api.js";
|
||||
import { getLocations, getLocationTypeByDefaultFor, getUserCurrentLocation } from "../api.js";
|
||||
|
||||
export default {
|
||||
name: "Location",
|
||||
@ -40,13 +40,8 @@ export default {
|
||||
NewLocation,
|
||||
VueMultiselect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
locations: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["activity"]),
|
||||
...mapState(["activity", "availableLocations"]),
|
||||
...mapGetters(["suggestedEntities"]),
|
||||
location: {
|
||||
get() {
|
||||
@ -57,53 +52,6 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
getLocations().then(
|
||||
(results) => {
|
||||
getLocationTypeByDefaultFor('person').then(
|
||||
(personLocationType) => {
|
||||
if (personLocationType) {
|
||||
const personLocation = this.makeAccompanyingPeriodLocation(personLocationType);
|
||||
const concernedPersonsLocation =
|
||||
this.makeConcernedPersonsLocation(personLocationType);
|
||||
getLocationTypeByDefaultFor('thirdparty').then(
|
||||
thirdpartyLocationType => {
|
||||
const concernedThirdPartiesLocation =
|
||||
this.makeConcernedThirdPartiesLocation(thirdpartyLocationType);
|
||||
this.locations = [
|
||||
{
|
||||
locationGroup: 'Localisation du parcours',
|
||||
locations: [personLocation]
|
||||
},
|
||||
{
|
||||
locationGroup: 'Parties concernées',
|
||||
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]
|
||||
},
|
||||
{
|
||||
locationGroup: 'Autres localisations',
|
||||
locations: results
|
||||
}
|
||||
];
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.locations = [
|
||||
{
|
||||
locationGroup: 'Localisations',
|
||||
locations: response.results
|
||||
}
|
||||
];
|
||||
}
|
||||
if (window.default_location_id) {
|
||||
let location = this.locations.filter(
|
||||
(l) => l.id === window.default_location_id
|
||||
);
|
||||
this.$store.dispatch("updateLocation", location);
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
labelAccompanyingCourseLocation(value) {
|
||||
return `${value.address.text} (${value.locationType.title.fr})`
|
||||
@ -117,58 +65,6 @@ export default {
|
||||
: value.locationType.title.fr
|
||||
: '';
|
||||
},
|
||||
makeConcernedPersonsLocation(locationType) {
|
||||
let locations = [];
|
||||
this.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'person' && e.current_household_address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -this.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: {
|
||||
id: e.current_household_address.address_id,
|
||||
},
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
},
|
||||
makeConcernedThirdPartiesLocation(locationType) {
|
||||
let locations = [];
|
||||
this.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'thirdparty' && e.address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -this.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: { id: e.address.address_id },
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
},
|
||||
makeAccompanyingPeriodLocation(locationType) {
|
||||
const accPeriodLocation = this.activity.accompanyingPeriod.location;
|
||||
return {
|
||||
type: 'location',
|
||||
id: -1,
|
||||
onthefly: true,
|
||||
name: '__AccompanyingCourseLocation__',
|
||||
address: {
|
||||
id: accPeriodLocation.address_id,
|
||||
text: `${accPeriodLocation.text} - ${accPeriodLocation.postcode.code} ${accPeriodLocation.postcode.name}`
|
||||
},
|
||||
locationType: locationType
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { postLocation } from './api';
|
||||
import prepareLocations from './store.locations.js';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
//console.log('window.activity', window.activity);
|
||||
@ -25,6 +26,7 @@ const store = createStore({
|
||||
activity: window.activity,
|
||||
socialIssuesOther: [],
|
||||
socialActionsList: [],
|
||||
availableLocations: [],
|
||||
},
|
||||
getters: {
|
||||
suggestedEntities(state) {
|
||||
@ -200,6 +202,9 @@ const store = createStore({
|
||||
console.log("### mutation: updateLocation", value);
|
||||
state.activity.location = value;
|
||||
},
|
||||
addAvailableLocationGroup(state, group) {
|
||||
state.availableLocations.push(group);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addIssueSelected({ commit }, issue) {
|
||||
@ -335,4 +340,6 @@ const store = createStore({
|
||||
},
|
||||
});
|
||||
|
||||
prepareLocations(store);
|
||||
|
||||
export default store;
|
||||
|
@ -0,0 +1,123 @@
|
||||
import {getLocations, getLocationTypeByDefaultFor, getUserCurrentLocation} from "./api";
|
||||
|
||||
const makeConcernedPersonsLocation = (locationType, store) => {
|
||||
let locations = [];
|
||||
store.getters.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'person' && e.current_household_address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -store.getters.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: {
|
||||
id: e.current_household_address.address_id,
|
||||
},
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
};
|
||||
const makeConcernedThirdPartiesLocation = (locationType, store) => {
|
||||
let locations = [];
|
||||
store.getters.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'thirdparty' && e.address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -store.getters.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: { id: e.address.address_id },
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
};
|
||||
const makeAccompanyingPeriodLocation = (locationType, store) => {
|
||||
const accPeriodLocation = store.state.activity.accompanyingPeriod.location;
|
||||
return {
|
||||
type: 'location',
|
||||
id: -1,
|
||||
onthefly: true,
|
||||
name: '__AccompanyingCourseLocation__',
|
||||
address: {
|
||||
id: accPeriodLocation.address_id,
|
||||
text: `${accPeriodLocation.text} - ${accPeriodLocation.postcode.code} ${accPeriodLocation.postcode.name}`
|
||||
},
|
||||
locationType: locationType
|
||||
}
|
||||
};
|
||||
|
||||
export default function prepareLocations(store) {
|
||||
|
||||
// find the locations
|
||||
let allLocations = getLocations().then(
|
||||
(results) => {
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Autres localisations',
|
||||
locations: results
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
let currentLocation = getUserCurrentLocation().then(
|
||||
userCurrentLocation => {
|
||||
if (null !== userCurrentLocation) {
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Ma localisation',
|
||||
locations: [userCurrentLocation]
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let partiesLocations = [], partyPromise;
|
||||
['person', 'thirdparty'].forEach(kind => {
|
||||
partyPromise = getLocationTypeByDefaultFor(kind).then(
|
||||
(kindLocationType) => {
|
||||
if (kindLocationType) {
|
||||
let concernedKindLocations;
|
||||
if (kind === 'person') {
|
||||
concernedKindLocations = makeConcernedPersonsLocation(kindLocationType, store);
|
||||
// add location for the parcours into suggestions
|
||||
const personLocation = makeAccompanyingPeriodLocation(kindLocationType, store);
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Localisation du parcours',
|
||||
locations: [personLocation]
|
||||
});
|
||||
} else {
|
||||
concernedKindLocations = makeConcernedThirdPartiesLocation(kindLocationType, store);
|
||||
}
|
||||
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: kind === 'person' ? 'Usagers concernés' : 'Tiers concernés',
|
||||
locations: concernedKindLocations,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
partiesLocations.push(partyPromise);
|
||||
});
|
||||
|
||||
// when all location are loaded
|
||||
Promise.all([allLocations, currentLocation, ...partiesLocations]).then(() => {
|
||||
console.log('current location in activity', store.state.activity.location);
|
||||
console.log('default loation id', window.default_location_id);
|
||||
if (window.default_location_id) {
|
||||
for (let group of store.state.availableLocations) {
|
||||
console.log(group);
|
||||
let location = group.locations.find((l) => l.id === window.default_location_id);
|
||||
console.log(location);
|
||||
if (location !== undefined) {
|
||||
store.dispatch('updateLocation', location);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -18,7 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
if (
|
||||
isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server')
|
||||
) {
|
||||
|
@ -127,10 +127,6 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
||||
durationTime
|
||||
travelTime
|
||||
comment
|
||||
{% if activity.comment.comment is not empty and is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
@ -145,6 +141,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
||||
durationTime
|
||||
travelTime
|
||||
comment
|
||||
documents
|
||||
attendee
|
||||
#}
|
||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
@ -64,8 +65,10 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Center
|
||||
&& in_array($attribute, $this->getAttributes(), true)) {
|
||||
if (
|
||||
$subject instanceof Center
|
||||
&& in_array($attribute, $this->getAttributes(), true)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
|
@ -26,7 +26,7 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class ActivityUserAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -24,7 +24,7 @@ final class CountActivityTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -24,7 +24,7 @@ final class ListActivityTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class StatActivityDurationSumTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -25,7 +25,7 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -45,7 +45,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -29,7 +29,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
|
||||
*/
|
||||
private static $prophet;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -44,7 +44,7 @@ final class ActivityVoterTest extends KernelTestCase
|
||||
*/
|
||||
protected $voter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->voter = self::$kernel->getContainer()
|
||||
|
@ -24,6 +24,7 @@ use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function strtr;
|
||||
|
@ -17,6 +17,7 @@ use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\Migrations\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ use DateTimeImmutable;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function random_int;
|
||||
|
||||
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||
|
@ -18,10 +18,12 @@ class LoadAsideActivityCategory extends \Doctrine\Bundle\FixturesBundle\Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
foreach ([
|
||||
foreach (
|
||||
[
|
||||
'Appel téléphonique',
|
||||
'Formation',
|
||||
] as $key => $label) {
|
||||
] as $key => $label
|
||||
) {
|
||||
$category = new AsideActivityCategory();
|
||||
$category->setTitle(['fr' => $label]);
|
||||
$manager->persist($category);
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\AsideActivityBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
use function is_int;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
|
@ -32,6 +32,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AsideActivityFormType extends AbstractType
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\AsideActivityBundle\Menu;
|
||||
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||
|
@ -26,7 +26,7 @@ final class AsideActivityControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\AMLI\BudgetBundle\Calculator;
|
||||
|
||||
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
|
||||
use OutOfBoundsException;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_keys;
|
||||
use function implode;
|
||||
|
@ -21,6 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function get_class;
|
||||
|
||||
abstract class AbstractElementController extends Controller
|
||||
|
@ -22,6 +22,7 @@ use Psr\Log\LoggerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
|
@ -21,6 +21,7 @@ use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_flip;
|
||||
use function asort;
|
||||
|
||||
|
@ -21,6 +21,7 @@ use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_flip;
|
||||
|
||||
class ResourceType extends AbstractType
|
||||
|
@ -18,6 +18,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
|
@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use function count;
|
||||
|
||||
class CalendarRangeAPIController extends ApiController
|
||||
|
@ -28,6 +28,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Event;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
class ListenToActivityCreate
|
||||
|
@ -20,7 +20,6 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
@ -1,6 +1,10 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { postLocation } from 'ChillActivityAssets/vuejs/Activity/api';
|
||||
import {
|
||||
getLocations, getLocationTypeByDefaultFor,
|
||||
getUserCurrentLocation
|
||||
} from "../../../../../ChillActivityBundle/Resources/public/vuejs/Activity/api";
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
@ -217,9 +221,7 @@ const store = createStore({
|
||||
hiddenLocation.value = value.id;
|
||||
}
|
||||
commit("updateLocation", value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -92,8 +92,11 @@
|
||||
%}
|
||||
<div class="item-row details">
|
||||
<div class="item-col">
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': accompanyingCourse, 'with_display': 'row', 'entity': calendar } %}
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||
'context': accompanyingCourse,
|
||||
'with_display': 'row',
|
||||
'entity': calendar
|
||||
} %}
|
||||
</div>
|
||||
|
||||
{% if calendar.comment.comment is not empty %}
|
||||
|
@ -26,7 +26,7 @@ final class CalendarControllerTest extends WebTestCase
|
||||
/**
|
||||
* Setup before each test method (see phpunit doc).
|
||||
*/
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->client = self::createClient([], [
|
||||
|
@ -25,6 +25,7 @@ use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,7 @@ use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
@ -21,6 +21,7 @@ use LogicException;
|
||||
use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use function get_class;
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
|
@ -18,7 +18,6 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
|
||||
|
||||
|
@ -20,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
class CustomFieldText extends AbstractCustomField
|
||||
@ -65,8 +66,10 @@ class CustomFieldText extends AbstractCustomField
|
||||
|
||||
$attrArray = [];
|
||||
|
||||
if (array_key_exists(self::MULTIPLE_CF_INLINE, $options)
|
||||
&& $options[self::MULTIPLE_CF_INLINE]) {
|
||||
if (
|
||||
array_key_exists(self::MULTIPLE_CF_INLINE, $options)
|
||||
&& $options[self::MULTIPLE_CF_INLINE]
|
||||
) {
|
||||
$attrArray['class'] = 'multiple-cf-inline';
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class CustomFieldsGroupType extends AbstractType
|
||||
|
@ -15,6 +15,7 @@ use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
use function gettype;
|
||||
|
||||
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
|
@ -14,7 +14,9 @@ namespace Chill\CustomFieldsBundle\Form\DataTransformer;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
@ -33,7 +35,9 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
|
||||
// @TODO: in the array_map callback, CustomField::getLabel() does not exist. What do we do here?
|
||||
$customFieldsLablels = array_map(
|
||||
static function ($e) { return $e->getLabel(); },
|
||||
static function ($e) {
|
||||
return $e->getLabel();
|
||||
},
|
||||
$customFields
|
||||
);
|
||||
|
||||
|
@ -15,6 +15,7 @@ use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
|
||||
class ChoicesListType extends AbstractType
|
||||
|
@ -18,7 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
if (
|
||||
isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server')
|
||||
) {
|
||||
|
@ -37,7 +37,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*/
|
||||
private $cfProvider;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
@ -46,7 +46,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
$this->cfChoice = $this->cfProvider->getCustomFieldByType('choice');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -28,7 +28,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
*/
|
||||
private $customFieldProvider;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->customFieldProvider = self::$kernel->getContainer()
|
||||
|
@ -27,7 +27,7 @@ final class PostTextIntegerExtensionTest extends KernelTestCase
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -27,7 +27,7 @@ final class PostTextNumberExtensionTest extends KernelTestCase
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -33,7 +33,7 @@ final class CustomFieldsHelperTest extends KernelTestCase
|
||||
*/
|
||||
private $randomCFText;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@ -34,7 +34,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
*/
|
||||
private $cfRendering;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->cfRendering = self::$kernel->getContainer()
|
||||
|
@ -36,7 +36,7 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
|
||||
*/
|
||||
private $cfRendering;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->cfRendering = self::$kernel->getContainer()
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\DocGeneratorBundle\Context\Exception;
|
||||
|
||||
use LogicException;
|
||||
|
||||
use function get_class;
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
|
@ -28,12 +28,10 @@ use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
// TODO à mettre dans services
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
@ -42,7 +40,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
@ -206,8 +203,10 @@ final class DocGeneratorTemplateController extends AbstractController
|
||||
|
||||
$contextGenerationData = [];
|
||||
|
||||
if ($context instanceof DocGeneratorContextWithPublicFormInterface
|
||||
&& $context->hasPublicForm($template, $entity) || $isTest) {
|
||||
if (
|
||||
$context instanceof DocGeneratorContextWithPublicFormInterface
|
||||
&& $context->hasPublicForm($template, $entity) || $isTest
|
||||
) {
|
||||
if ($context instanceof DocGeneratorContextWithPublicFormInterface) {
|
||||
$builder = $this->createFormBuilder(
|
||||
array_merge(
|
||||
|
@ -54,8 +54,10 @@ class DocGeneratorTemplateType extends AbstractType
|
||||
'required' => true,
|
||||
]);
|
||||
|
||||
if ($context instanceof DocGeneratorContextWithAdminFormInterface
|
||||
&& $context->hasAdminForm()) {
|
||||
if (
|
||||
$context instanceof DocGeneratorContextWithAdminFormInterface
|
||||
&& $context->hasAdminForm()
|
||||
) {
|
||||
$sub = $builder
|
||||
->create('options', null, ['compound' => true])
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
|
@ -46,6 +46,7 @@ class RelatorioDriver implements DriverInterface
|
||||
'template' => new DataPart($template, $templateName ?? uniqid('template_'), $resourceType),
|
||||
];
|
||||
$form = new FormDataPart($formFields);
|
||||
dump(json_encode($data));
|
||||
|
||||
try {
|
||||
$response = $this->relatorioClient->request('POST', $this->url, [
|
||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
@ -11,13 +11,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Serializer\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Encoder\EncoderInterface;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use function array_keys;
|
||||
use function is_array;
|
||||
|
||||
class DocGenEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInterface
|
||||
class DocGenEncoder implements EncoderInterface
|
||||
{
|
||||
public function encode($data, string $format, array $context = [])
|
||||
public function encode($data, $format, array $context = [])
|
||||
{
|
||||
if (!$this->isAssociative($data)) {
|
||||
throw new UnexpectedValueException('Only associative arrays are allowed; lists are not allowed');
|
||||
@ -29,7 +31,7 @@ class DocGenEncoder implements \Symfony\Component\Serializer\Encoder\EncoderInte
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function supportsEncoding(string $format)
|
||||
public function supportsEncoding($format)
|
||||
{
|
||||
return 'docgen' === $format;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\DocGeneratorBundle\Serializer\Helper;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
use function array_merge;
|
||||
|
||||
class NormalizeNullValueHelper
|
||||
|
@ -26,10 +26,11 @@ class CollectionDocGenNormalizer implements ContextAwareNormalizerInterface, Nor
|
||||
|
||||
/**
|
||||
* @param Collection $object
|
||||
* @param null|string $format
|
||||
*
|
||||
* @return array|ArrayObject|bool|float|int|string|void|null
|
||||
*/
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, $format = null, array $context = [])
|
||||
{
|
||||
$data = [];
|
||||
|
||||
@ -44,7 +45,7 @@ class CollectionDocGenNormalizer implements ContextAwareNormalizerInterface, Nor
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = [])
|
||||
public function supportsNormalization($data, $format = null, array $context = [])
|
||||
{
|
||||
if ('docgen' !== $format) {
|
||||
return false;
|
||||
|
@ -26,6 +26,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
use function array_filter;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
@ -54,7 +55,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, $format = null, array $context = [])
|
||||
{
|
||||
$classMetadataKey = $object ?? $context['docgen:expects'] ?? null;
|
||||
|
||||
@ -95,7 +96,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
return $this->normalizeObject($object, $format, $context, $expectedGroups, $metadata, $attributes);
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
public function supportsNormalization($data, $format = null): bool
|
||||
{
|
||||
return 'docgen' === $format && (is_object($data) || null === $data);
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Service\Context;
|
||||
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class BaseContextData
|
||||
{
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security, NormalizerInterface $normalizer)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->normalizer = $normalizer;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
$data = [];
|
||||
$user = $this->security->getUser();
|
||||
|
||||
$data['creator'] = $this->normalizer->normalize(
|
||||
$user instanceof User ? $user : null,
|
||||
'docgen',
|
||||
['docgen:expects' => User::class, 'groups' => ['docgen:read']]
|
||||
);
|
||||
$data['createdAt'] = $this->normalizer->normalize(new DateTimeImmutable(), 'docgen', [
|
||||
'docgen:expects' => DateTimeImmutable::class, 'groups' => ['docgen:read'],
|
||||
]);
|
||||
$data['location'] = $this->normalizer->normalize(
|
||||
$user instanceof User ? $user->getCurrentLocation() : null,
|
||||
'docgen',
|
||||
['docgen:expects' => Location::class, 'groups' => ['docgen:read']]
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -34,6 +34,11 @@ services:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\DocGeneratorBundle\Service\Context\:
|
||||
resource: "../Service/Context/"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\DocGeneratorBundle\GeneratorDriver\:
|
||||
resource: "../GeneratorDriver/"
|
||||
autowire: true
|
||||
|
@ -23,7 +23,7 @@ final class DocGenEncoderTest extends TestCase
|
||||
{
|
||||
private DocGenEncoder $encoder;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -25,7 +25,7 @@ final class DocGenObjectNormalizerTest extends KernelTestCase
|
||||
{
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\tests\Service\Context;
|
||||
|
||||
use Chill\DocGeneratorBundle\Service\Context\BaseContextData;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BaseContextDataTest extends KernelTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
public function testGenerateNoContext()
|
||||
{
|
||||
$context = $this->buildBaseContext();
|
||||
|
||||
$actual = $context->getData();
|
||||
|
||||
$this->assertIsArray($actual);
|
||||
$this->assertArrayHasKey('creator', $actual);
|
||||
$this->assertArrayHasKey('createdAt', $actual);
|
||||
$this->assertArrayHasKey('location', $actual);
|
||||
}
|
||||
|
||||
public function testGenerateWithUser()
|
||||
{
|
||||
$security = $this->prophesize(Security::class);
|
||||
$security->getUser()->willReturn(new User());
|
||||
|
||||
$context = $this->buildBaseContext($security->reveal());
|
||||
|
||||
$actual = $context->getData();
|
||||
|
||||
$this->assertIsArray($actual);
|
||||
$this->assertArrayHasKey('creator', $actual);
|
||||
$this->assertArrayHasKey('createdAt', $actual);
|
||||
$this->assertArrayHasKey('location', $actual);
|
||||
}
|
||||
|
||||
private function buildBaseContext(
|
||||
?Security $security = null,
|
||||
?NormalizerInterface $normalizer = null
|
||||
): BaseContextData {
|
||||
return new BaseContextData(
|
||||
$security ?? self::$container->get(Security::class),
|
||||
$normalizer ?? self::$container->get(NormalizerInterface::class)
|
||||
);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user