Compare commits

..

139 Commits

Author SHA1 Message Date
Pol Dellaiera
ee4e0b86fd ci: Autofix code style. 2021-05-07 22:39:37 +02:00
Pol Dellaiera
ce4cbe3b8d Fix syntax errors. 2021-05-07 21:59:49 +02:00
Pol Dellaiera
c5b8b6345d Upgrade drupol/php-conventions to v5. 2021-05-07 21:59:49 +02:00
8b51bfbaf5 force type for connection parameter 2021-05-07 21:59:49 +02:00
Pol Dellaiera
f6cf0dba2f chore: Add/update static files. 2021-05-07 21:59:49 +02:00
Pol Dellaiera
0625afecdd chore: Update composer.json 2021-05-07 19:43:46 +02:00
a63c38b6aa Merge branch '37_modal_add-persons' 2021-05-07 15:46:38 +02:00
8915c42008 endpoint DELETE participation works ! 2021-05-07 15:44:08 +02:00
503293a359 Merge branch 'master' into '37_modal_add-persons'
# Conflicts:
#   src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
#   src/Bundle/ChillPersonBundle/chill.webpack.config.js
2021-05-07 13:35:48 +00:00
7bdf71315a move Modal component in ChillMainAssets 2021-05-07 15:28:50 +02:00
6f5d457122 renaming store state dict name 2021-05-07 15:16:27 +02:00
b4274264a7 create addPersons store module, move state/getters/mutations/actions in module 2021-05-07 15:04:36 +02:00
8002725c87 fix doc for api 2021-05-07 12:42:49 +02:00
2c9edf3741 Set Collection normalization to fit into specs from https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/136 2021-05-07 12:13:24 +02:00
3f562449e1 Merge branch 'issue23_addresses' into 'master'
Issue23 addresses

See merge request Chill-Projet/chill-bundles!12
2021-05-07 09:27:56 +00:00
1cce39bcb5 Merge branch 'bootstrap-api' into 'master'
Bootstrap api

See merge request Chill-Projet/chill-bundles!35
2021-05-07 09:14:11 +00:00
ad690db886 display reset link + minor changes 2021-05-07 10:36:50 +02:00
nobohan
1b8462b40d update validto field in chill_main_address for legacy 2021-05-07 10:27:11 +02:00
Pol Dellaiera
8c98f2cf6e Update .gitignore file. 2021-05-07 09:04:29 +02:00
f3260f57a4 fix display elements order
selectAndSuggested method in store getter, is callable in all components,
and make union of two arrays: suggested and selected

* we need to have selected in last position (required for isChecked method to work well)
* but we want to display selected in first position (for better ux)

then, we use double inversion to obtain good behaviour
2021-05-06 19:23:28 +02:00
b4ad0128e4 manage selected and suggested arrays: fix duplicate 2021-05-06 19:15:25 +02:00
e1c8278f71 Merge branch 'fix-return-type' into 'master'
Fix return type of Person::getAddresses().

See merge request Chill-Projet/chill-bundles!39
2021-05-06 15:05:35 +00:00
Pol Dellaiera
ed3f46ce7f Fix return type. 2021-05-06 17:01:11 +02:00
33457d3cbc Merge branch 'fix-accompanying-period-opening' into bootstrap-api 2021-05-06 16:02:13 +02:00
e919b4322e fix accompanying period/remove person 2021-05-06 15:49:38 +02:00
7503c845df Merge branch 'dev-undefined-index' into 'master'
fix undefined index in person edit form

See merge request Chill-Projet/chill-bundles!26
2021-05-06 13:47:13 +00:00
3686a294d3 fix return type for person::getAddresses 2021-05-06 13:57:44 +02:00
b6131379f9 Merge remote-tracking branch 'origin/master' into bootstrap-api 2021-05-06 13:20:12 +02:00
e1fcc41ace avoiding duplicates between selected and suggested (wip)
see comments in store/index.js
2021-05-06 13:16:26 +02:00
f2a04cebe6 configure origin route into chillMainExtension 2021-05-06 13:12:18 +02:00
c693002ddb documentation for api - prepend config 2021-05-06 13:11:59 +02:00
ee77c8540a fix typos 2021-05-06 13:00:59 +02:00
a536d2780e fix state mutation for closeParticipation 2021-05-06 12:57:53 +02:00
f880598052 documentation for api 2021-05-06 12:56:19 +02:00
e7985ea52f customize controller for origin 2021-05-06 12:55:40 +02:00
f56dc65021 fix argument order 2021-05-06 12:55:12 +02:00
nobohan
4770758aee add migrations for addresse on household + add linkedtothirdparty on address 2021-05-06 12:36:58 +02:00
90fe484d81 fix api for rendering a single item 2021-05-06 12:18:47 +02:00
2b8bbe019d first impl for index action 2021-05-06 12:08:45 +02:00
9e1c151402 réinitialize suggested, avoiding double with selected (wip) 2021-05-06 10:57:04 +02:00
088e522292 Merge branch 'master' into _31_interface_creation_parcours 2021-05-06 10:55:22 +02:00
b8e6e98a74 fix payload error with add participation 2021-05-06 10:44:15 +02:00
2db847ada2 Merge branch 'drupol-fix-person-addresses' into 'master'
Fix person addresses

See merge request Chill-Projet/chill-bundles!33
2021-05-06 07:14:54 +00:00
07e0692783 bootstrap api and apply on accompanying period 2021-05-06 00:14:36 +02:00
e78d53064b closeParticipation fetch DELETE request 2021-05-05 21:48:00 +02:00
e6fcb5ff22 Merge branch '_test_closePerson' into _31_interface_creation_parcours 2021-05-05 20:47:39 +02:00
f02e33fda7 first impl for api 2021-05-05 20:33:34 +02:00
1bbec9efae improve addpersons store cycle: init query, selections and suggestions 2021-05-05 19:25:28 +02:00
3b53c4451c fix modal ux counter position 2021-05-05 18:45:51 +02:00
30f490959b for each selected, loop for post participation, then get response and commit state 2021-05-05 18:44:26 +02:00
nobohan
0a894b0db1 add new fields on Address and Household 2021-05-05 18:24:58 +02:00
c20e9507d5 prepare close participation button (wip) 2021-05-05 15:03:58 +02:00
f89c690f1b add scratch fontawesome 'remove' button 2021-05-05 13:36:45 +02:00
Pol Dellaiera
7819c1204c Merge branch '4-remove-unused-main-test-route' into 'master'
Issue #4: Remove obsolete route.

Closes #4

See merge request Chill-Projet/chill-bundles!31
2021-05-05 10:30:03 +00:00
nobohan
f61af9d02a add household and householdmembers entities + migration 2021-05-05 11:44:55 +02:00
Pol Dellaiera
e470a6a97e Merge remote-tracking branch 'tmp/fix-person-last-address' into drupol-fix-person-addresses 2021-05-05 11:24:18 +02:00
Pol Dellaiera
cd8c47449b Issue #4: Remove obsolete route. 2021-05-05 11:11:25 +02:00
120e7cade5 simplify store suggested array 2021-05-05 11:11:13 +02:00
ac550e05e8 improve addPersons modal ux 2021-05-05 09:29:57 +02:00
d6e7fadb4f Merge branch 'issue_43_admin_prosoc' into 'master'
URGENT : Fix namespace pbm

See merge request Chill-Projet/chill-bundles!30
2021-05-05 07:00:05 +00:00
Marc Ducobu
2be1c08c44 Fix namespace pbm 2021-05-04 19:14:50 +02:00
nobohan
86c177bbbb remove vuejs address component 2021-05-04 17:26:47 +02:00
Pol Dellaiera
d426d28ba0 Merge branch 'add-readme' into 'master'
docs: Add root README file.

See merge request Chill-Projet/chill-bundles!29
2021-05-04 13:14:14 +00:00
Pol Dellaiera
72e69fc0b3 docs: Add root README file. 2021-05-04 14:49:36 +02:00
cc8de353d4 moving selected counter + cleaning code 2021-05-04 10:48:58 +02:00
4495a5d33b Union suggested and selected results 2021-05-03 23:15:38 +02:00
9dffe30aad Merge branch '_31_interface_creation_parcours' of gitlab.com:Chill-Projet/chill-bundles into _31_interface_creation_parcours 2021-05-03 22:53:47 +02:00
d393e74896 save checkboxes state in store 2021-05-03 22:44:28 +02:00
daf083dc88 save checkboxes state in store 2021-05-03 21:02:15 +02:00
nobohan
ce859697b5 Use json endpoint for showing address with Vuejs Components (WIP) 2021-05-03 17:16:45 +02:00
nobohan
1587c762f8 better fixture for AddressReference 2021-05-03 14:34:23 +02:00
nobohan
17c01d9b46 fix fixture for address reference 2021-05-03 12:18:21 +02:00
a1bb9ea352 modal addPerson design, search field: focus and position fixed 2021-05-03 11:52:06 +02:00
nobohan
a1895ec65f fixture for addressReference - WIP 2021-05-03 11:18:31 +02:00
nobohan
c5faa0b99d update the address fixture by adding some points 2021-05-03 09:28:05 +02:00
nobohan
e9d142f3e8 define legacy functions for Address 2021-05-03 09:28:05 +02:00
nobohan
91860afd80 check if point value is null for 2 methods in PointType 2021-05-03 09:28:05 +02:00
nobohan
bec0700d39 Point model: better handling of exception 2021-05-03 09:28:05 +02:00
nobohan
05d3d7f5c7 update twig template and AddressType following the changes in Address entity 2021-05-03 09:28:05 +02:00
nobohan
ebff36d257 add unit test for class Point 2021-05-03 09:28:05 +02:00
nobohan
a709b3afb6 add addressReference in Chill Main + migration 2021-05-03 09:28:05 +02:00
nobohan
69a3c6a9b2 refine the migration comment 2021-05-03 09:28:05 +02:00
juminet
8c33d876e8 code formatting in PointType 2021-05-03 09:28:05 +02:00
nobohan
1ec2fbcc16 translated exception messages in English 2021-05-03 09:28:05 +02:00
juminet
bc4e29141b syntax (null -> NULL and == -> ===) 2021-05-03 09:28:05 +02:00
nobohan
e90ea31683 add type hinting in Point and PointException 2021-05-03 09:28:05 +02:00
juminet
7c99f0b3e0 array synatx: array() -> [] 2021-05-03 09:28:05 +02:00
nobohan
c089960707 add type hinting in Point and PointException 2021-05-03 09:28:05 +02:00
nobohan
0b2f29f1e8 add migration for address 2021-05-03 09:28:05 +02:00
nobohan
9a4f50472a add point type + Address: add Point field : fix dependency injection of the Point type 2021-05-03 09:28:05 +02:00
nobohan
7d1a1c4004 #32 add point type + Address: add Point field + add null on nullable fields 2021-05-03 09:28:05 +02:00
nobohan
ebd58d4229 add more fields to Address entity + rename streetAddress1 and streetAddress2 2021-05-03 09:25:41 +02:00
nobohan
dd48795f64 #23 enable postgis in a chil main migration 2021-05-03 09:25:41 +02:00
3d45b6687f adding addPersons component with modal, search field and basic suggestions 2021-04-30 23:18:57 +02:00
35e6d36ce0 fetch postParticipation request, catch fetch error, store mutation+action 2021-04-30 16:33:49 +02:00
4900c81c11 improve inheritance with translations i18n.js files
vue-i18n --> chill main i18n ---( )---> app index
chill bundle i18n --> app i18n --^
2021-04-30 16:32:06 +02:00
52472b0ec3 Merge branch 'fix-tests-main' into 'master'
Fix tests for chill main bundle

See merge request Chill-Projet/chill-bundles!24
2021-04-29 22:35:47 +00:00
ec68e6f761 make inheritance for vue translations i18n.js files
By importing only the app i18n file,
we benefit from the whole inherited chain:

app i18n < chill bundle i18n < chill main bundle i18n
2021-04-29 18:32:22 +02:00
25bd170f6b improve modal system, test when a modal call next modal 2021-04-29 15:49:25 +02:00
6939b4a313 Merge branch 'master' into _31_interface_creation_parcours 2021-04-29 14:19:02 +02:00
d18922ed98 permit multiple modals in same component 2021-04-29 14:04:40 +02:00
e8bf242c42 Merge branch '_31_interface_creation_parcours' of gitlab.com:Chill-Projet/chill-bundles into _31_interface_creation_parcours 2021-04-29 12:44:29 +02:00
2050460bb3 add modal system, added/removed managed by vue, appearence managed by bootstrap
Modal component is an hybrid solution between :
- Vue3 modal implementation
  => with 'v-if:showModal' directive:parameter, html scope is added/removed not just shown/hidden
  => with slot we can pass content from parent component
  => some classes are passed from parent component
- Bootstrap 4.4 _modal.scss module
  => using bootstrap css classes, the modal have a responsive behaviour,
  => modal design can be configured using css classes (size, scroll)

See
* https://v3.vuejs.org/examples/modal.html#modal-component
* https://github.com/bootstrap-vue/bootstrap-vue/issues/5196
2021-04-29 12:40:28 +02:00
nobohan
4add30e895 add fixture for parcours: replace createQuery by createQueryBuilder 2021-04-29 12:23:41 +02:00
e1dbfdafd7 test modals with vue and modals with bootstrap 2021-04-28 22:01:05 +02:00
75becb2294 Merge branch '_31_interface_creation_parcours' of gitlab.com:Chill-Projet/chill-bundles into _31_interface_creation_parcours 2021-04-28 21:58:52 +02:00
94e494361f adding show/edit links (prepare modal) + save button 2021-04-28 18:00:46 +02:00
cab3b1059d ChillMainBundle: use localize function 2021-04-28 15:56:50 +02:00
nobohan
d27bdf68fb Merge branch '_31_interface_creation_parcours' of https://gitlab.com/Chill-Projet/chill-bundles into _31_interface_creation_parcours
merge..
2021-04-28 12:24:29 +02:00
nobohan
82b82920e1 add 2 fixtures for parcours 2021-04-28 12:24:25 +02:00
4bb3eadf91 renaming vuejs root dir 2021-04-28 11:41:15 +02:00
4c82e65c1f Merge branch '14-correctif-creation-personne' into 'master'
Use injected EntityManager - fix property visibility.

See merge request Chill-Projet/chill-bundles!25
2021-04-28 08:36:34 +00:00
cf4d7df7ad Merge branch 'bootstrap-serializer' into 'master'
Bootstrap serializer

See merge request Chill-Projet/chill-bundles!17
2021-04-28 08:32:02 +00:00
86d13410c3 Merge branch 'bootstrap-serializer' into fix-tests-main 2021-04-28 10:29:53 +02:00
19fdf2a503 Add test for AccompanyingCourseController 2021-04-28 10:28:10 +02:00
3a0c25c871 fix addPerson feature with vue3+store+i18n 2021-04-28 10:10:16 +02:00
083338da8d Merge branch 'master' into _31_interface_creation_parcours 2021-04-28 08:54:20 +02:00
37e5c9ceaa Merge branch '_31_interface_creation_parcours' of gitlab.com:Chill-Projet/chill-bundles into _31_interface_creation_parcours 2021-04-28 08:49:32 +02:00
Pol Dellaiera
5448238697 Set final keyword - remove redundant information in phpdoc. 2021-04-28 07:21:19 +02:00
Pol Dellaiera
c5250a1059 Use injected EntityManager - fix property visibility. 2021-04-27 23:07:59 +02:00
b2c1a7b8de Merge remote-tracking branch 'origin/master' into fix-tests-main 2021-04-27 22:50:32 +02:00
b4583fc6dc improve serializers 2021-04-27 22:48:48 +02:00
f7c508939c Add test for AccompanyingCourseController 2021-04-27 22:40:00 +02:00
4cf77a9b0e adapt multi components to new store and new api endpoints
* base of i18n (yarn add new deps)
2021-04-27 22:03:39 +02:00
a2160bef7d WIP: first implementation for test 2021-04-27 19:33:34 +02:00
nobohan
c2a4a95eba add a fixture for accompanying period - wip 2021-04-27 18:52:37 +02:00
8641d6bdce try to fix correct values for redis 2021-04-27 18:06:58 +02:00
5f4d513aa6 try to connect to redis in gitlab-ci 2021-04-27 17:57:09 +02:00
f47b15de39 try to fix .gitlab-ci with correct redis parameters 2021-04-27 17:52:12 +02:00
7426dc02cf currently restrict to chill main test suite 2021-04-27 17:18:46 +02:00
a570160aed update chill app to working commit 2021-04-27 17:18:26 +02:00
7596bd5a06 fix tests for chill main 2021-04-27 16:33:44 +02:00
01f9d03b14 init vuex store 2021-04-27 15:11:13 +02:00
66426f5102 serializer on accompanying course
Two new routes:

* `GET /{_locale}/person/api/1.0/accompanying-course/{parcours_id}/show.json`: get a json representation for a course
* `POST /{_locale}/person/api/1.0/accompanying-course/{parcours_id}/participation.json`:
add a particitipation to course. Usage:

    `curl -v --cookie "PHPSESSID=fed98aa23e40cb36e630f84155aea3bb;" -X
POST --data '{ "id": 481 }'
http://localhost:8001/fr/person/api/1.0/accompanying-course/270/participation.json`

    Will add the person with id "481" to the course.
2021-04-26 17:01:22 +02:00
Pol Dellaiera
03243605da Remove unrelated code style change. 2021-04-02 11:18:52 +02:00
Pol Dellaiera
48e2d2ceab Do not use DateTimeImmutable. 2021-04-02 11:18:48 +02:00
Pol Dellaiera
777fb25860 tests: Add missing test based on review's feedback. 2021-04-02 11:12:50 +02:00
Pol Dellaiera
03601b9707 Update Person::getLastAddress() based on feedback. 2021-04-02 11:11:24 +02:00
c205bbddd3 writing test to reproduce bug 2021-03-08 10:26:12 +01:00
878 changed files with 8802 additions and 7206 deletions

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ docs/build/
/phpunit.xml /phpunit.xml
.phpunit.result.cache .phpunit.result.cache
###< phpunit/phpunit ### ###< phpunit/phpunit ###

View File

@@ -30,6 +30,10 @@ variables:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
# fetch the chill-app using git submodules # fetch the chill-app using git submodules
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_URL: redis://redis:6379
# Run our tests # Run our tests
test: test:

71
.php-cs-fixer.dist.php Normal file
View File

@@ -0,0 +1,71 @@
<?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.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
use drupol\PhpCsFixerConfigsPhp\Config\Php7;
use PhpCsFixer\RuleSet\RuleSetDescriptionInterface;
use PhpCsFixer\RuleSet\RuleSets;
require __DIR__ . '/vendor/autoload.php';
$vendorDirectory = dirname((new ReflectionClass(Php7::class))->getFileName(), 5);
$config = require $vendorDirectory . '/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
$config
->getFinder()
->ignoreDotFiles(false);
$rules = $config->getRules();
$riskyRules = array_reduce(
array_filter(
RuleSets::getSetDefinitions(),
static function (RuleSetDescriptionInterface $ruleset): bool {
return $ruleset->isRisky();
}
),
static function (array $carry, RuleSetDescriptionInterface $ruleSetDescription): array {
return array_merge($carry, array_keys($ruleSetDescription->getRules()));
},
[]
);
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
// Remove properties containing the word 'risky'.
// Remove custom risky properties
$rules = array_filter(
array_filter(
array_diff_key(
$rules,
array_flip($riskyRules)
),
static function (string $property): bool {
return false === strpos(strtolower($property), 'risky');
},
ARRAY_FILTER_USE_KEY
),
static function (string $property): bool {
return false === in_array(
$property,
[
'static_lambda',
'ordered_interfaces',
'psr4',
]
);
},
ARRAY_FILTER_USE_KEY
);
return $config->setRules($rules);

View File

@@ -1,25 +0,0 @@
<?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.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
$config = require __DIR__ . '/vendor/drupol/php-conventions/config/php73/php_cs_fixer.config.php';
$config
->getFinder()
->ignoreDotFiles(false)
->name(['.php_cs.dist']);
$rules = $config->getRules();
$rules['header_comment']['header'] = trim(file_get_contents(__DIR__ . '/resource/header.txt'));
return $config->setRules($rules);

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# Chill framework
Documentation of the Chill software.
The online documentation can be found at http://docs.chill.social
See the [`docs`][1] directory for more.
[1]: docs/README.md

View File

@@ -64,7 +64,7 @@
"symfony/symfony": "*" "symfony/symfony": "*"
}, },
"require-dev": { "require-dev": {
"drupol/php-conventions": "4.*", "drupol/php-conventions": "5.*",
"fakerphp/faker": "^1.13", "fakerphp/faker": "^1.13",
"phpunit/phpunit": "^7.0", "phpunit/phpunit": "^7.0",
"symfony/dotenv": "^5.1", "symfony/dotenv": "^5.1",

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter; namespace Chill\PersonBundle\Export\Filter;
use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface;
@@ -20,7 +16,7 @@ use Doctrine\ORM\Query\Expr;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface class BirthdateFilter implements FilterInterface, ExportElementValidatedInterface
{ {
// add specific role for this filter // add specific role for this filter
public function addRole() public function addRole()

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export; namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\ExportInterface;
@@ -93,7 +89,7 @@ class CountPerson implements ExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{ {
// we gather all center the user choose. // we gather all center the user choose.
$centers = array_map(static function ($el) { $centers = array_map(function ($el) {
return $el['center']; return $el['center'];
}, $acl); }, $acl);

View File

@@ -0,0 +1,453 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _api:
API
###
Chill provides a basic framework to build REST api.
Configure a route
=================
Follow those steps to build a REST api:
1. Create your model;
2. Configure the API;
You can also:
* hook into the controller to customize some steps;
* add more route and steps
.. note::
Useful links:
* `How to use annotation to configure serialization <https://symfony.com/doc/current/serializer.html>`_
* `How to create your custom normalizer <https://symfony.com/doc/current/serializer/custom_normalizer.html>`_
Auto-loading the routes
***********************
Ensure that those lines are present in your file `app/config/routing.yml`:
.. code-block:: yaml
chill_cruds:
resource: 'chill_main_crud_route_loader:load'
type: service
Create your model
*****************
Create your model on the usual way:
.. code-block:: php
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\OriginRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=OriginRepository::class)
* @ORM\Table(name="chill_person_accompanying_period_origin")
*/
class Origin
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="json")
*/
private $label;
/**
* @ORM\Column(type="date_immutable", nullable=true)
*/
private $noActiveAfter;
// .. getters and setters
}
Configure api
*************
Configure the api using Yaml (see the full configuration: :ref:`api_full_configuration`):
.. code-block:: yaml
# config/packages/chill_main.yaml
chill_main:
apis:
accompanying_period_origin:
base_path: '/api/1.0/person/accompanying-period/origin'
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
name: accompanying_period_origin
base_role: 'ROLE_USER'
actions:
_index:
methods:
GET: true
HEAD: true
_entity:
methods:
GET: true
HEAD: true
.. note::
If you are working on a shared bundle (aka "The chill bundles"), you should define your configuration inside the class :code:`ChillXXXXBundleExtension`, using the "prependConfig" feature:
.. code-block:: php
namespace Chill\PersonBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpFoundation\Request;
/**
* Class ChillPersonExtension
* Loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
* @package Chill\PersonBundle\DependencyInjection
*/
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
{
$this->prependCruds($container);
}
/**
* @param ContainerBuilder $container
*/
protected function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'apis' => [
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Origin::class,
'name' => 'accompanying_period_origin',
'base_path' => '/api/1.0/person/accompanying-period/origin',
'controller' => \Chill\PersonBundle\Controller\OpeningApiController::class,
'base_role' => 'ROLE_USER',
'actions' => [
'_index' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
],
],
'_entity' => [
'methods' => [
Request::METHOD_GET => true,
Request::METHOD_HEAD => true
]
],
]
]
]
]);
}
}
The :code:`_index` and :code:`_entity` action
=============================================
The :code:`_index` and :code:`_entity` action are default actions:
* they will call a specific method in the default controller;
* they will generate defined routes:
Index:
Name: :code:`chill_api_single_accompanying_period_origin__index`
Path: :code:`/api/1.0/person/accompanying-period/origin.{_format}`
Entity:
Name: :code:`chill_api_single_accompanying_period_origin__entity`
Path: :code:`/api/1.0/person/accompanying-period/origin/{id}.{_format}`
Role
====
By default, the key `base_role` is used to check ACL. Take care of creating the :code:`Voter` required to take that into account.
For index action, the role will be called with :code:`NULL` as :code:`$subject`. The retrieved entity will be the subject for single queries.
You can also define a role for each method. In this case, this role is used for the given method, and, if any, the base role is taken into account.
.. code-block:: yaml
# config/packages/chill_main.yaml
chill_main:
apis:
accompanying_period_origin:
base_path: '/api/1.0/person/bla/bla'
class: 'Chill\PersonBundle\Entity\Blah'
name: bla
actions:
_entity:
methods:
GET: true
HEAD: true
roles:
GET: MY_ROLE_SEE
HEAD: MY ROLE_SEE
Customize the controller
========================
You can customize the controller by hooking into the default actions. Take care of extending :code:`Chill\MainBundle\CRUD\Controller\ApiController`.
.. code-block:: php
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class OpeningApiController extends ApiController
{
protected function customizeQuery(string $action, Request $request, $qb): void
{
$qb->where($qb->expr()->gt('e.noActiveAfter', ':now'))
->orWhere($qb->expr()->isNull('e.noActiveAfter'));
$qb->setParameter('now', new \DateTime('now'));
}
}
And set your controller in configuration:
.. code-block:: yaml
chill_main:
apis:
accompanying_period_origin:
base_path: '/api/1.0/person/accompanying-period/origin'
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod\Origin'
name: accompanying_period_origin
# add a controller
controller: 'Chill\PersonBundle\Controller\OpeningApiController'
base_role: 'ROLE_USER'
actions:
_index:
methods:
GET: true
HEAD: true
_entity:
methods:
GET: true
HEAD: true
Create your own actions
=======================
You can add your own actions:
.. code-block:: yaml
chill_main:
apis:
-
class: Chill\PersonBundle\Entity\AccompanyingPeriod
name: accompanying_course
base_path: /api/1.0/person/accompanying-course
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
actions:
# add a custom participation:
participation:
methods:
POST: true
DELETE: true
GET: false
HEAD: false
PUT: false
roles:
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
GET: null
HEAD: null
PUT: null
single-collection: single
The key :code:`single-collection` with value :code:`single` will add a :code:`/{id}/ + "action name"` (in this example, :code:`/{id}/participation`) into the path, after the base path. If the value is :code:`collection`, no id will be set, but the action name will be append to the path.
Then, create the corresponding action into your controller:
.. code-block:: php
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent;
use Chill\PersonBundle\Entity\Person;
class AccompanyingCourseApiController extends ApiController
{
protected EventDispatcherInterface $eventDispatcher;
protected ValidatorInterface $validator;
public function __construct(EventDispatcherInterface $eventDispatcher, $validator)
{
$this->eventDispatcher = $eventDispatcher;
$this->validator = $validator;
}
public function participationApi($id, Request $request, $_format)
{
/** @var AccompanyingPeriod $accompanyingPeriod */
$accompanyingPeriod = $this->getEntity('participation', $id, $request);
$person = $this->getSerializer()
->deserialize($request->getContent(), Person::class, $_format, []);
if (NULL === $person) {
throw new BadRequestException('person id not found');
}
$this->onPostCheckACL('participation', $request, $accompanyingPeriod, $_format);
switch ($request->getMethod()) {
case Request::METHOD_POST:
$participation = $accompanyingPeriod->addPerson($person);
break;
case Request::METHOD_DELETE:
$participation = $accompanyingPeriod->removePerson($person);
break;
default:
throw new BadRequestException("This method is not supported");
}
$errors = $this->validator->validate($accompanyingPeriod);
if ($errors->count() > 0) {
// only format accepted
return $this->json($errors);
}
$this->getDoctrine()->getManager()->flush();
return $this->json($participation);
}
}
Serialization for collection
============================
A specific model has been defined for returning collection:
.. code-block:: json
{
"count": 49,
"results": [
],
"pagination": {
"more": true,
"next": "/api/1.0/search.json&q=xxxx......&page=2",
"previous": null,
"first": 0,
"items_per_page": 1
}
}
This can be achieved quickly by assembling results into a :code:`Chill\MainBundle\Serializer\Model\Collection`. The pagination information is given by using :code:`Paginator` (see :ref:`Pagination <pagination-ref>`).
.. code-block:: php
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Chill\MainBundle\Pagination\PaginatorInterface;
class MyController extends AbstractController
{
protected function serializeCollection(PaginatorInterface $paginator, $entities): Response
{
$model = new Collection($entities, $paginator);
return $this->json($model, Response::HTTP_OK, [], $context);
}
}
.. _api_full_configuration:
Full configuration example
==========================
.. code-block:: yaml
apis:
-
class: Chill\PersonBundle\Entity\AccompanyingPeriod
name: accompanying_course
base_path: /api/1.0/person/accompanying-course
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
actions:
_entity:
roles:
GET: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
HEAD: null
POST: null
DELETE: null
PUT: null
controller_action: null
path: null
single-collection: single
methods:
GET: true
HEAD: true
POST: false
DELETE: false
PUT: false
participation:
methods:
POST: true
DELETE: true
GET: false
HEAD: false
PUT: false
roles:
POST: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
DELETE: CHILL_PERSON_ACCOMPANYING_PERIOD_SEE
GET: null
HEAD: null
PUT: null
controller_action: null
# the requirements for the route. Will be set to `[ 'id' => '\d+' ]` if left empty.
requirements: []
path: null
single-collection: single
base_role: null

View File

@@ -16,6 +16,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
Instructions to create a new bundle <create-a-new-bundle.rst> Instructions to create a new bundle <create-a-new-bundle.rst>
CRUD (Create - Update - Delete) for one entity <crud.rst> CRUD (Create - Update - Delete) for one entity <crud.rst>
Helpers for building a REST API <api.rst>
Routing <routing.rst> Routing <routing.rst>
Menus <menus.rst> Menus <menus.rst>
Forms <forms.rst> Forms <forms.rst>

View File

@@ -7,6 +7,8 @@
Free Documentation License". Free Documentation License".
.. _pagination-ref:
Pagination Pagination
########## ##########
@@ -15,7 +17,7 @@ The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow yo
A simple example A simple example
**************** ****************
In the controller, get the :class:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance. In the controller, get the :code:`Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this :code:`PaginatorFactory` to create a :code:`Paginator` instance.
.. literalinclude:: pagination/example.php .. literalinclude:: pagination/example.php

View File

@@ -1,21 +1,17 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\MyBundle\Controller; namespace Chill\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class example extends Controller class ItemController extends Controller
{ {
public function yourAction() public function yourAction()
{ {
@@ -40,12 +36,13 @@ class example extends Controller
// use the paginator to get the number of items to display // use the paginator to get the number of items to display
->setMaxResults($paginator->getItemsPerPage()); ->setMaxResults($paginator->getItemsPerPage());
return $this->render( return $this
'ChillMyBundle:Item:list.html.twig', ->render(
[ 'ChillMyBundle:Item:list.html.twig',
'items' => $items, [
'paginator' => $paginator, 'items' => $items,
] 'paginator' => $paginator,
); ]
);
} }
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\HealthBundle\Controller; namespace Chill\HealthBundle\Controller;
use Chill\HealthBundle\Security\Authorization\ConsultationVoter; use Chill\HealthBundle\Security\Authorization\ConsultationVoter;
@@ -29,7 +25,7 @@ class ConsultationController extends Controller
*/ */
public function listAction($id) public function listAction($id)
{ {
/** @var \Chill\PersonBundle\Entity\Person $person */ /* @var $person \Chill\PersonBundle\Entity\Person */
$person = $this->get('chill.person.repository.person') $person = $this->get('chill.person.repository.person')
->find($id); ->find($id);
@@ -39,7 +35,7 @@ class ConsultationController extends Controller
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person); $this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
/** @var \Chill\MainBundle\Security\Authorization\AuthorizationHelper $authorizationHelper */ /* @var $authorizationHelper \Chill\MainBundle\Security\Authorization\AuthorizationHelper */
$authorizationHelper = $this->get('chill.main.security.' $authorizationHelper = $this->get('chill.main.security.'
. 'authorization.helper'); . 'authorization.helper');

View File

@@ -1,18 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
// Chill\MainBundle\DependencyInjection\Configuration.php
namespace Chill\MainBundle\DependencyInjection; namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait; use Chill\MainBundle\DependencyInjection\Widget\AddWidgetConfigurationTrait;
@@ -23,7 +17,7 @@ namespace Chill\MainBundle\DependencyInjection;
/** /**
* Configure the main bundle. * Configure the main bundle.
*/ */
class ChillMainConfiguration implements ConfigurationInterface class Configuration implements ConfigurationInterface
{ {
use AddWidgetConfigurationTrait; use AddWidgetConfigurationTrait;
@@ -33,7 +27,7 @@ class ChillMainConfiguration implements ConfigurationInterface
private $containerBuilder; private $containerBuilder;
public function __construct( public function __construct(
array $widgetFactories, array $widgetFactories = [],
ContainerBuilder $containerBuilder ContainerBuilder $containerBuilder
) { ) {
// we register here widget factories (see below) // we register here widget factories (see below)
@@ -42,9 +36,6 @@ class ChillMainConfiguration implements ConfigurationInterface
$this->containerBuilder = $containerBuilder; $this->containerBuilder = $containerBuilder;
} }
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder(); $treeBuilder = new TreeBuilder();
@@ -62,8 +53,7 @@ class ChillMainConfiguration implements ConfigurationInterface
->end() // end of widgets/children ->end() // end of widgets/children
->end() // end of widgets ->end() // end of widgets
->end() // end of root/children ->end() // end of root/children
->end() // end of root ->end(); // end of root
;
return $treeBuilder; return $treeBuilder;
} }

View File

@@ -1,18 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
//Chill\MainBundle\DependencyInjection\ChillMainExtension.php
namespace Chill\MainBundle\DependencyInjection; namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface; use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;

View File

@@ -1,18 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
// Chill/PersonBundle/Widget/PersonListWidgetFactory
namespace Chill\PersonBundle\Widget; namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory; use Chill\MainBundle\DependencyInjection\Widget\Factory\AbstractWidgetFactory;
@@ -22,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
/** /**
* add configuration for the person_list widget. * add configuration for the person_list widget.
*/ */
class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory class PersonListWidgetFactory extends AbstractWidgetFactory
{ {
/* /*
* append the option to the configuration * append the option to the configuration
@@ -42,8 +36,8 @@ class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
->end(); ->end();
} }
/** /*
* return an array with the allowed places where the widget can be rendered. * return an array with the allowed places where the widget can be rendered
* *
* @return string[] * @return string[]
*/ */
@@ -65,8 +59,8 @@ class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
return 'chill_person.widget.person_list'; return 'chill_person.widget.person_list';
} }
/** /*
* return the widget alias. * return the widget alias
* *
* @return string * @return string
*/ */

View File

@@ -1,18 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
// Chill/PersonBundle/Widget/PersonListWidget.php
namespace Chill\PersonBundle\Widget; namespace Chill\PersonBundle\Widget;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
@@ -33,7 +27,7 @@ use Twig_Environment;
* *
* The configuration is defined by `PersonListWidgetFactory` * The configuration is defined by `PersonListWidgetFactory`
*/ */
class ChillPersonAddAPersonWidget implements WidgetInterface class PersonListWidget implements WidgetInterface
{ {
/** /**
* the authorization helper. * the authorization helper.

View File

@@ -1,18 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
// Chill/PersonBundle/DependencyInjection/ChillPersonExtension.php
namespace Chill\PersonBundle\DependencyInjection; namespace Chill\PersonBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -26,9 +20,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/ */
class ChillPersonExtension extends Extension implements PrependExtensionInterface class ChillPersonExtension extends Extension implements PrependExtensionInterface
{ {
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container) public function load(array $configs, ContainerBuilder $container)
{ {
// ... // ...

View File

@@ -2,7 +2,8 @@ imports:
- { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml } - { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml }
parameters: parameters:
tasks.phpcsfixer.config: .php_cs.dist tasks.phpcsfixer.config: .php-cs-fixer.dist.php
tasks.license.name: AGPL-3.0 tasks.license.name: AGPL-3.0
tasks.license.holder: Champs-Libres tasks.license.holder: Champs-Libres
tasks.license.date_from: 2001 tasks.license.date_from: 2001
tasks.phpcsfixer.allow_risky: false

View File

@@ -18,11 +18,11 @@
<testsuite name="MainBundle"> <testsuite name="MainBundle">
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory> <directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
</testsuite> </testsuite>
<!--
<testsuite name="PersonBundle"> <testsuite name="PersonBundle">
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory> <directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
</testsuite> </testsuite>
-->
</testsuites> </testsuites>
<listeners> <listeners>

View File

@@ -1,6 +1,5 @@
Chill is a software for social workers. Chill is a software for social workers
For the full copyright and license information, please view For the full copyright and license information, please view
the LICENSE file that was distributed with this source code. the LICENSE file that was distributed with this source code.
@see https://www.champs-libres.coop/

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle; namespace Chill\ActivityBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Bundle\Bundle;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller; namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\Activity;
@@ -25,6 +21,9 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
/**
* Class ActivityController.
*/
class ActivityController extends AbstractController class ActivityController extends AbstractController
{ {
/** /**
@@ -128,7 +127,7 @@ class ActivityController extends AbstractController
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
/** @var Activity $activity */ /* @var $activity Activity */
$activity = $em->getRepository('ChillActivityBundle:Activity') $activity = $em->getRepository('ChillActivityBundle:Activity')
->find($id); ->find($id);
$person = $activity->getPerson(); $person = $activity->getPerson();
@@ -152,7 +151,7 @@ class ActivityController extends AbstractController
'comment' => $activity->getComment()->getComment(), 'comment' => $activity->getComment()->getComment(),
'scope_id' => $activity->getScope()->getId(), 'scope_id' => $activity->getScope()->getId(),
'reasons_ids' => $activity->getReasons() 'reasons_ids' => $activity->getReasons()
->map(static function ($ar) { ->map(function ($ar) {
return $ar->getId(); return $ar->getId();
}) })
->toArray(), ->toArray(),

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller; namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Entity\ActivityReasonCategory; use Chill\ActivityBundle\Entity\ActivityReasonCategory;
@@ -19,6 +15,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReasonCategory controller.
*/
class ActivityReasonCategoryController extends AbstractController class ActivityReasonCategoryController extends AbstractController
{ {
/** /**

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller; namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;
@@ -19,6 +15,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* ActivityReason controller.
*/
class ActivityReasonController extends AbstractController class ActivityReasonController extends AbstractController
{ {
/** /**

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller; namespace Chill\ActivityBundle\Controller;
use Chill\ActivityBundle\Entity\ActivityType; use Chill\ActivityBundle\Entity\ActivityType;
@@ -19,6 +15,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/**
* Class ActivityTypeController.
*/
class ActivityTypeController extends AbstractController class ActivityTypeController extends AbstractController
{ {
/** /**

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Controller; namespace Chill\ActivityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM; namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\Activity;
@@ -22,12 +18,10 @@ use Doctrine\Persistence\ObjectManager;
use Faker\Factory as FakerFactory; use Faker\Factory as FakerFactory;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use function in_array;
/** /**
* Load reports into DB. * Load reports into DB.
*/ */
class LoadActivity extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{ {
use \Symfony\Component\DependencyInjection\ContainerAwareTrait; use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -53,7 +47,7 @@ class LoadActivity extends AbstractFixture implements ContainerAwareInterface, O
->findAll(); ->findAll();
foreach ($persons as $person) { foreach ($persons as $person) {
$activityNbr = mt_rand(0, 3); $activityNbr = rand(0, 3);
for ($i = 0; $i < $activityNbr; ++$i) { for ($i = 0; $i < $activityNbr; ++$i) {
echo 'Creating an activity type for : ' . $person . "\n"; echo 'Creating an activity type for : ' . $person . "\n";
@@ -77,7 +71,7 @@ class LoadActivity extends AbstractFixture implements ContainerAwareInterface, O
$usedId = []; $usedId = [];
for ($i = 0; mt_rand(0, 4) > $i; ++$i) { for ($i = 0; rand(0, 4) > $i; ++$i) {
$reason = $this->getRandomActivityReason($usedId); $reason = $this->getRandomActivityReason($usedId);
$usedId[] = $reason->getId(); $usedId[] = $reason->getId();
$activity->addReason($reason); $activity->addReason($reason);
@@ -95,7 +89,7 @@ class LoadActivity extends AbstractFixture implements ContainerAwareInterface, O
{ {
$reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)]; $reasonRef = LoadActivityReason::$references[array_rand(LoadActivityReason::$references)];
if (in_array($this->getReference($reasonRef)->getId(), $excludingIds, true)) { if (in_array($this->getReference($reasonRef)->getId(), $excludingIds)) {
// we have a reason which should be excluded. Find another... // we have a reason which should be excluded. Find another...
return $this->getRandomActivityReason($excludingIds); return $this->getRandomActivityReason($excludingIds);
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM; namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM; namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityReasonCategory; use Chill\ActivityBundle\Entity\ActivityReasonCategory;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DataFixtures\ORM; namespace Chill\ActivityBundle\DataFixtures\ORM;
use Chill\ActivityBundle\Entity\ActivityType; use Chill\ActivityBundle\Entity\ActivityType;

View File

@@ -1,12 +1,10 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
namespace Chill\ActivityBundle\DataFixtures\ORM; namespace Chill\ActivityBundle\DataFixtures\ORM;
@@ -19,10 +17,10 @@ use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager; use Doctrine\Persistence\ObjectManager;
use function in_array; /**
* Add a role CHILL_ACTIVITY_UPDATE & CHILL_ACTIVITY_CREATE for all groups except administrative,
declare(strict_types=1); * and a role CHILL_ACTIVITY_SEE for administrative.
*/
class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterface
{ {
public function getOrder() public function getOrder()
@@ -45,9 +43,10 @@ class LoadActivitytACL extends AbstractFixture implements OrderedFixtureInterfac
} }
break; break;
case 'administrative': case 'administrative':
case 'direction': case 'direction':
if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) { if (in_array($scope->getName()['en'], ['administrative', 'social'])) {
break 2; // we do not want any power on social or administrative break 2; // we do not want any power on social or administrative
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection; namespace Chill\ActivityBundle\DependencyInjection;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
@@ -27,9 +23,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/ */
class ChillActivityExtension extends Extension implements PrependExtensionInterface class ChillActivityExtension extends Extension implements PrependExtensionInterface
{ {
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container) public function load(array $configs, ContainerBuilder $container)
{ {
$configuration = new Configuration(); $configuration = new Configuration();
@@ -66,7 +59,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
]); ]);
} }
/** (non-PHPdoc). /* (non-PHPdoc)
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend() * @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/ */
public function prependRoutes(ContainerBuilder $container) public function prependRoutes(ContainerBuilder $container)

View File

@@ -1,23 +1,17 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\DependencyInjection; namespace Chill\ActivityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\ConfigurationInterface;
use function is_int;
/** /**
* This is the class that validates and merges configuration from your app/config files. * This is the class that validates and merges configuration from your app/config files.
* *
@@ -25,9 +19,6 @@ use function is_int;
*/ */
class Configuration implements ConfigurationInterface class Configuration implements ConfigurationInterface
{ {
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder('chill_activity'); $treeBuilder = new TreeBuilder('chill_activity');
@@ -64,7 +55,7 @@ class Configuration implements ConfigurationInterface
->info('The number of seconds of this duration. Must be an integer.') ->info('The number of seconds of this duration. Must be an integer.')
->cannotBeEmpty() ->cannotBeEmpty()
->validate() ->validate()
->ifTrue(static function ($data) { ->ifTrue(function ($data) {
return !is_int($data); return !is_int($data);
})->thenInvalid('The value %s is not a valid integer') })->thenInvalid('The value %s is not a valid integer')
->end() ->end()

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity; namespace Chill\ActivityBundle\Entity;
use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Center;
@@ -27,6 +23,8 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Class Activity.
*
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="activity") * @ORM\Table(name="activity")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks

View File

@@ -1,21 +1,19 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity; namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Class ActivityReason.
*
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="activityreason") * @ORM\Table(name="activityreason")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks

View File

@@ -1,22 +1,20 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity; namespace Chill\ActivityBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Class ActivityReasonCategory.
*
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="activityreasoncategory") * @ORM\Table(name="activityreasoncategory")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks

View File

@@ -1,21 +1,19 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Entity; namespace Chill\ActivityBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Class ActivityType.
*
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="activitytype") * @ORM\Table(name="activitytype")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator; namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
@@ -26,9 +22,6 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function count;
class ActivityReasonAggregator implements class ActivityReasonAggregator implements
AggregatorInterface, AggregatorInterface,
ExportElementValidatedInterface ExportElementValidatedInterface
@@ -86,7 +79,7 @@ class ActivityReasonAggregator implements
array_key_exists('activity', $join) array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
) )
|| (!array_key_exists('activity', $join)) or (!array_key_exists('activity', $join))
) { ) {
$qb->add( $qb->add(
'join', 'join',
@@ -140,6 +133,7 @@ class ActivityReasonAggregator implements
$this->reasonRepository->findBy(['id' => $values]); $this->reasonRepository->findBy(['id' => $values]);
break; break;
case 'categories': case 'categories':
$this->categoryRepository->findBy(['id' => $values]); $this->categoryRepository->findBy(['id' => $values]);
@@ -162,7 +156,7 @@ class ActivityReasonAggregator implements
switch ($data['level']) { switch ($data['level']) {
case 'reasons': case 'reasons':
/** @var \Chill\ActivityBundle\Entity\ActivityReason $r */ /* @var $r \Chill\ActivityBundle\Entity\ActivityReason */
$r = $this->reasonRepository->find($value); $r = $this->reasonRepository->find($value);
return $this->stringHelper->localize($r->getCategory()->getName()) return $this->stringHelper->localize($r->getCategory()->getName())
@@ -170,6 +164,7 @@ class ActivityReasonAggregator implements
. $this->stringHelper->localize($r->getName()); . $this->stringHelper->localize($r->getName());
break; break;
case 'categories': case 'categories':
$c = $this->categoryRepository->find($value); $c = $this->categoryRepository->find($value);

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator; namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
@@ -78,7 +74,7 @@ class ActivityTypeAggregator implements AggregatorInterface
return 'Activity type'; return 'Activity type';
} }
/** @var \Chill\ActivityBundle\Entity\ActivityType $r */ /* @var $r \Chill\ActivityBundle\Entity\ActivityType */
$t = $this->typeRepository->find($value); $t = $this->typeRepository->find($value);
return $this->stringHelper->localize($t->getName()); return $this->stringHelper->localize($t->getName());

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Aggregator; namespace Chill\ActivityBundle\Export\Aggregator;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export; namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
@@ -53,7 +49,7 @@ class CountActivity implements ExportInterface
throw new LogicException("the key {$key} is not used by this export"); throw new LogicException("the key {$key} is not used by this export");
} }
return static function ($value) { return function ($value) {
return '_header' === $value ? return '_header' === $value ?
'Number of activities' 'Number of activities'
: :
@@ -84,7 +80,7 @@ class CountActivity implements ExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{ {
$qb = $this->entityManager->createQueryBuilder(); $qb = $this->entityManager->createQueryBuilder();
$centers = array_map(static function ($el) { $centers = array_map(function ($el) {
return $el['center']; return $el['center'];
}, $acl); }, $acl);

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export; namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;
@@ -29,8 +25,6 @@ use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists; use function array_key_exists;
use function count;
use function in_array;
/** /**
* Create a list for all activities. * Create a list for all activities.
@@ -76,9 +70,6 @@ class ListActivity implements ListInterface
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;
} }
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder) public function buildForm(FormBuilderInterface $builder)
{ {
$builder->add('fields', ChoiceType::class, [ $builder->add('fields', ChoiceType::class, [
@@ -87,7 +78,7 @@ class ListActivity implements ListInterface
'choices' => array_combine($this->fields, $this->fields), 'choices' => array_combine($this->fields, $this->fields),
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'constraints' => [new Callback([ 'constraints' => [new Callback([
'callback' => static function ($selected, ExecutionContextInterface $context) { 'callback' => function ($selected, ExecutionContextInterface $context) {
if (count($selected) === 0) { if (count($selected) === 0) {
$context->buildViolation('You must select at least one element') $context->buildViolation('You must select at least one element')
->atPath('fields') ->atPath('fields')
@@ -99,8 +90,6 @@ class ListActivity implements ListInterface
} }
/** /**
* {@inheritdoc}
*
* @return type * @return type
*/ */
public function getAllowedFormattersTypes() public function getAllowedFormattersTypes()
@@ -117,7 +106,7 @@ class ListActivity implements ListInterface
{ {
switch ($key) { switch ($key) {
case 'date': case 'date':
return static function ($value) { return function ($value) {
if ('_header' === $value) { if ('_header' === $value) {
return 'date'; return 'date';
} }
@@ -126,16 +115,18 @@ class ListActivity implements ListInterface
return $date->format('d-m-Y'); return $date->format('d-m-Y');
}; };
case 'attendee': case 'attendee':
return static function ($value) { return function ($value) {
if ('_header' === $value) { if ('_header' === $value) {
return 'attendee'; return 'attendee';
} }
return $value ? 1 : 0; return $value ? 1 : 0;
}; };
case 'list_reasons': case 'list_reasons':
/** @var EntityRepository $activityReasonsRepository */ /* @var $activityReasonsRepository EntityRepository */
$activityRepository = $this->entityManager $activityRepository = $this->entityManager
->getRepository('ChillActivityBundle:Activity'); ->getRepository('ChillActivityBundle:Activity');
@@ -155,6 +146,7 @@ class ListActivity implements ListInterface
. '"'; . '"';
}, $activity->getReasons()->toArray())); }, $activity->getReasons()->toArray()));
}; };
case 'circle_name': case 'circle_name':
return function ($value) { return function ($value) {
if ('_header' === $value) { if ('_header' === $value) {
@@ -164,6 +156,7 @@ class ListActivity implements ListInterface
return $this->translatableStringHelper return $this->translatableStringHelper
->localize(json_decode($value, true)); ->localize(json_decode($value, true));
}; };
case 'type_name': case 'type_name':
return function ($value) { return function ($value) {
if ('_header' === $value) { if ('_header' === $value) {
@@ -175,7 +168,7 @@ class ListActivity implements ListInterface
}; };
default: default:
return static function ($value) use ($key) { return function ($value) use ($key) {
if ('_header' === $value) { if ('_header' === $value) {
return $key; return $key;
} }
@@ -207,7 +200,7 @@ class ListActivity implements ListInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{ {
$centers = array_map(static function ($el) { $centers = array_map(function ($el) {
return $el['center']; return $el['center'];
}, $acl); }, $acl);
@@ -227,39 +220,46 @@ class ListActivity implements ListInterface
->setParameter('authorized_centers', $centers); ->setParameter('authorized_centers', $centers);
foreach ($this->fields as $f) { foreach ($this->fields as $f) {
if (in_array($f, $data['fields'], true)) { if (in_array($f, $data['fields'])) {
switch ($f) { switch ($f) {
case 'id': case 'id':
$qb->addSelect('activity.id AS id'); $qb->addSelect('activity.id AS id');
break; break;
case 'person_firstname': case 'person_firstname':
$qb->addSelect('person.firstName AS person_firstname'); $qb->addSelect('person.firstName AS person_firstname');
break; break;
case 'person_lastname': case 'person_lastname':
$qb->addSelect('person.lastName AS person_lastname'); $qb->addSelect('person.lastName AS person_lastname');
break; break;
case 'person_id': case 'person_id':
$qb->addSelect('person.id AS person_id'); $qb->addSelect('person.id AS person_id');
break; break;
case 'user_username': case 'user_username':
$qb->join('activity.user', 'user'); $qb->join('activity.user', 'user');
$qb->addSelect('user.username AS user_username'); $qb->addSelect('user.username AS user_username');
break; break;
case 'circle_name': case 'circle_name':
$qb->join('activity.scope', 'circle'); $qb->join('activity.scope', 'circle');
$qb->addSelect('circle.name AS circle_name'); $qb->addSelect('circle.name AS circle_name');
break; break;
case 'type_name': case 'type_name':
$qb->join('activity.type', 'type'); $qb->join('activity.type', 'type');
$qb->addSelect('type.name AS type_name'); $qb->addSelect('type.name AS type_name');
break; break;
case 'list_reasons': case 'list_reasons':
// this is a trick... The reasons is filled with the // this is a trick... The reasons is filled with the
// activity id which will be used to load reasons // activity id which will be used to load reasons

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Export; namespace Chill\ActivityBundle\Export\Export;
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
@@ -81,7 +77,7 @@ class StatActivityDuration implements ExportInterface
$header = 'Sum of activities duration'; $header = 'Sum of activities duration';
} }
return static function ($value) use ($header) { return function ($value) use ($header) {
return '_header' === $value ? return '_header' === $value ?
$header $header
: :
@@ -113,7 +109,7 @@ class StatActivityDuration implements ExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{ {
$centers = array_map(static function ($el) { $centers = array_map(function ($el) {
return $el['center']; return $el['center'];
}, $acl); }, $acl);
$qb = $this->entityManager->createQueryBuilder(); $qb = $this->entityManager->createQueryBuilder();

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter; namespace Chill\ActivityBundle\Export\Filter;
use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Export\FilterInterface;
@@ -84,7 +80,7 @@ class ActivityDateFilter implements FilterInterface
]); ]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
/** @var \Symfony\Component\Form\FormInterface $filterForm */ /* @var $filterForm \Symfony\Component\Form\FormInterface */
$filterForm = $event->getForm()->getParent(); $filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData(); $enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter; namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;
@@ -27,12 +23,9 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function count;
class ActivityReasonFilter implements class ActivityReasonFilter implements
ExportElementValidatedInterface, FilterInterface,
FilterInterface ExportElementValidatedInterface
{ {
/** /**
* The repository for activity reasons. * The repository for activity reasons.
@@ -71,7 +64,7 @@ class ActivityReasonFilter implements
array_key_exists('activity', $join) array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
) )
|| (!array_key_exists('activity', $join)) or (!array_key_exists('activity', $join))
) { ) {
$qb->add( $qb->add(
'join', 'join',
@@ -102,10 +95,10 @@ class ActivityReasonFilter implements
$builder->add('reasons', EntityType::class, [ $builder->add('reasons', EntityType::class, [
'class' => 'ChillActivityBundle:ActivityReason', 'class' => 'ChillActivityBundle:ActivityReason',
'choice_label' => static function (ActivityReason $reason) use ($helper) { 'choice_label' => function (ActivityReason $reason) use ($helper) {
return $helper->localize($reason->getName()); return $helper->localize($reason->getName());
}, },
'group_by' => static function (ActivityReason $reason) use ($helper) { 'group_by' => function (ActivityReason $reason) use ($helper) {
return $helper->localize($reason->getCategory()->getName()); return $helper->localize($reason->getCategory()->getName());
}, },
'multiple' => true, 'multiple' => true,

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter; namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Entity\ActivityType; use Chill\ActivityBundle\Entity\ActivityType;
@@ -27,11 +23,9 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function count;
class ActivityTypeFilter implements class ActivityTypeFilter implements
ExportElementValidatedInterface, FilterInterface,
FilterInterface ExportElementValidatedInterface
{ {
/** /**
* @var TranslatableStringHelper * @var TranslatableStringHelper
@@ -85,7 +79,7 @@ class ActivityTypeFilter implements
$builder->add('types', EntityType::class, [ $builder->add('types', EntityType::class, [
'class' => ActivityType::class, 'class' => ActivityType::class,
'choice_label' => static function (ActivityType $type) use ($helper) { 'choice_label' => function (ActivityType $type) use ($helper) {
return $helper->localize($type->getName()); return $helper->localize($type->getName());
}, },
'multiple' => true, 'multiple' => true,

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Export\Filter; namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;
@@ -30,11 +26,9 @@ use Symfony\Component\Form\FormEvents;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function count;
class PersonHavingActivityBetweenDateFilter implements class PersonHavingActivityBetweenDateFilter implements
ExportElementValidatedInterface, FilterInterface,
FilterInterface ExportElementValidatedInterface
{ {
/** /**
* @var EntityRepository * @var EntityRepository
@@ -151,7 +145,7 @@ class PersonHavingActivityBetweenDateFilter implements
]); ]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
/** @var \Symfony\Component\Form\FormInterface $filterForm */ /* @var $filterForm \Symfony\Component\Form\FormInterface */
$filterForm = $event->getForm()->getParent(); $filterForm = $event->getForm()->getParent();
$enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData(); $enabled = $filterForm->get(FilterType::ENABLED_FIELD)->getData();

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form; namespace Chill\ActivityBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Form\Type\TranslatableStringFormType;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form; namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReasonCategory; use Chill\ActivityBundle\Form\Type\TranslatableActivityReasonCategory;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form; namespace Chill\ActivityBundle\Form;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason; use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
@@ -36,8 +32,6 @@ use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use function in_array;
class ActivityType extends AbstractType class ActivityType extends AbstractType
{ {
/** /**
@@ -135,7 +129,7 @@ class ActivityType extends AbstractType
$builder->get('durationTime') $builder->get('durationTime')
->addEventListener( ->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
static function (FormEvent $formEvent) use ( function (FormEvent $formEvent) use (
$timeChoices, $timeChoices,
$builder, $builder,
$durationTimeTransformer, $durationTimeTransformer,
@@ -144,7 +138,7 @@ class ActivityType extends AbstractType
// set the timezone to GMT, and fix the difference between current and GMT // set the timezone to GMT, and fix the difference between current and GMT
// the datetimetransformer will then handle timezone as GMT // the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new DateTimeZone('GMT'); $timezoneUTC = new DateTimeZone('GMT');
/** @var DateTime $data */ /* @var $data \DateTime */
$data = $formEvent->getData() === null ? $data = $formEvent->getData() === null ?
DateTime::createFromFormat('U', 300) : DateTime::createFromFormat('U', 300) :
$formEvent->getData(); $formEvent->getData();
@@ -154,7 +148,7 @@ class ActivityType extends AbstractType
// test if the timestamp is in the choices. // test if the timestamp is in the choices.
// If not, recreate the field with the new timestamp // If not, recreate the field with the new timestamp
if (!in_array($data->getTimestamp(), $timeChoices, true)) { if (!in_array($data->getTimestamp(), $timeChoices)) {
// 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( $form = $builder->create(

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form; namespace Chill\ActivityBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Form\Type\TranslatableStringFormType;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type; namespace Chill\ActivityBundle\Form\Type;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;
@@ -59,7 +55,7 @@ class TranslatableActivityReason extends AbstractType
return null; return null;
}, },
'query_builder' => static function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('r') return $er->createQueryBuilder('r')
->where('r.active = true'); ->where('r.active = true');
}, },

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type; namespace Chill\ActivityBundle\Form\Type;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
@@ -41,7 +37,7 @@ class TranslatableActivityReasonCategory extends AbstractType
[ [
'class' => 'ChillActivityBundle:ActivityReasonCategory', 'class' => 'ChillActivityBundle:ActivityReasonCategory',
'choice_label' => 'name[' . $locale . ']', 'choice_label' => 'name[' . $locale . ']',
'query_builder' => static function (EntityRepository $er) { 'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('c') return $er->createQueryBuilder('c')
->where('c.active = true'); ->where('c.active = true');
}, },

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Form\Type; namespace Chill\ActivityBundle\Form\Type;
use Chill\ActivityBundle\Entity\ActivityType; use Chill\ActivityBundle\Entity\ActivityType;
@@ -42,7 +38,7 @@ class TranslatableActivityType extends AbstractType
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options) public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options)
{ {
/** @var \Doctrine\ORM\QueryBuilder $qb */ /* @var $qb \Doctrine\ORM\QueryBuilder */
$qb = $options['query_builder']; $qb = $options['query_builder'];
if (true === $options['active_only']) { if (true === $options['active_only']) {

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Menu; namespace Chill\ActivityBundle\Menu;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
@@ -50,7 +46,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters) public function buildMenu($menuId, MenuItem $menu, array $parameters)
{ {
/** @var \Chill\PersonBundle\Entity\Person $person */ /* @var $person \Chill\PersonBundle\Entity\Person */
$person = $parameters['person']; $person = $parameters['person'];
$user = $this->tokenStorage->getToken()->getUser(); $user = $this->tokenStorage->getToken()->getUser();
$roleSee = new Role(ActivityVoter::SEE); $roleSee = new Role(ActivityVoter::SEE);

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Menu; namespace Chill\ActivityBundle\Menu;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
@@ -41,7 +37,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
public function buildMenu($menuId, MenuItem $menu, array $parameters) public function buildMenu($menuId, MenuItem $menu, array $parameters)
{ {
/** @var \Chill\PersonBundle\Entity\Person $person */ /* @var $person \Chill\PersonBundle\Entity\Person */
$person = $parameters['person']; $person = $parameters['person'];
if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) { if ($this->authorizationChecker->isGranted(ActivityVoter::SEE, $person)) {

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
use Composer\Autoload\ClassLoader; use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\AnnotationRegistry;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
@@ -309,31 +305,22 @@ class appDevDebugProjectContainer extends Container
]; ];
} }
/**
* {@inheritdoc}
*/
public function compile() public function compile()
{ {
throw new LogicException('You cannot compile a dumped frozen container.'); throw new LogicException('You cannot compile a dumped frozen container.');
} }
/**
* {@inheritdoc}
*/
public function getParameter($name) public function getParameter($name)
{ {
$name = strtolower($name); $name = strtolower($name);
if (!(isset($this->parameters[$name]) || \array_key_exists($name, $this->parameters))) { if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
} }
return $this->parameters[$name]; return $this->parameters[$name];
} }
/**
* {@inheritdoc}
*/
public function getParameterBag() public function getParameterBag()
{ {
if (null === $this->parameterBag) { if (null === $this->parameterBag) {
@@ -343,19 +330,13 @@ class appDevDebugProjectContainer extends Container
return $this->parameterBag; return $this->parameterBag;
} }
/**
* {@inheritdoc}
*/
public function hasParameter($name) public function hasParameter($name)
{ {
$name = strtolower($name); $name = strtolower($name);
return isset($this->parameters[$name]) || \array_key_exists($name, $this->parameters); return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
} }
/**
* {@inheritdoc}
*/
public function setParameter($name, $value) public function setParameter($name, $value)
{ {
throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
@@ -4538,7 +4519,7 @@ class appDevDebugProjectContainer extends Container
$instance->addGlobal('app', $e); $instance->addGlobal('app', $e);
$instance->addGlobal('installation', ['name' => 'Chill']); $instance->addGlobal('installation', ['name' => 'Chill']);
$instance->addGlobal('available_languages', [0 => 'fr']); $instance->addGlobal('available_languages', [0 => 'fr']);
\call_user_func([new \Symfony\Bundle\TwigBundle\DependencyInjection\Configurator\EnvironmentConfigurator('F j, Y H:i', '%d days', null, 0, '.', ','), 'configure'], $instance); call_user_func([new \Symfony\Bundle\TwigBundle\DependencyInjection\Configurator\EnvironmentConfigurator('F j, Y H:i', '%d days', null, 0, '.', ','), 'configure'], $instance);
return $instance; return $instance;
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
use Symfony\Component\Debug\Debug; use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -23,7 +19,7 @@ use Symfony\Component\HttpFoundation\Request;
if ( if (
isset($_SERVER['HTTP_CLIENT_IP']) isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR']) || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(\in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server') || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
) { ) {
header('HTTP/1.0 403 Forbidden'); header('HTTP/1.0 403 Forbidden');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Security\Authorization; namespace Chill\ActivityBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Center;
@@ -69,7 +65,7 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
{ {
if ( if (
$subject instanceof Center $subject instanceof Center
&& in_array($attribute, $this->getAttributes(), true) && in_array($attribute, $this->getAttributes())
) { ) {
return true; return true;
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Security\Authorization; namespace Chill\ActivityBundle\Security\Authorization;
use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\Activity;
@@ -64,7 +60,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
protected function supports($attribute, $subject) protected function supports($attribute, $subject)
{ {
if ($subject instanceof Activity) { if ($subject instanceof Activity) {
return in_array($attribute, $this->getAttributes(), true); return in_array($attribute, $this->getAttributes());
} }
if ($subject instanceof Person) { if ($subject instanceof Person) {
@@ -84,7 +80,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
if ($subject instanceof Person) { if ($subject instanceof Person) {
$centers = $this->helper->getReachableCenters($token->getUser(), new Role($attribute)); $centers = $this->helper->getReachableCenters($token->getUser(), new Role($attribute));
return in_array($subject->getCenter(), $centers, true); return in_array($subject->getCenter(), $centers);
} }
/* @var $subject Activity */ /* @var $subject Activity */

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Templating\Entity; namespace Chill\ActivityBundle\Templating\Entity;
use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Entity\ActivityReason;

View File

@@ -1,31 +1,10 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/
declare(strict_types=1);
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
namespace Chill\ActivityBundle\Test; namespace Chill\ActivityBundle\Test;

View File

@@ -1,33 +1,27 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Controller; namespace Chill\ActivityBundle\Tests\Controller;
use RuntimeException; use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use function count;
use function in_array;
/** /**
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityControllerTest extends WebTestCase class ActivityControllerTest extends WebTestCase
{ {
public function getSecuredPagesAuthenticated() public function getSecuredPagesAuthenticated()
{ {
self::bootKernel(); static::bootKernel();
$person = $this->getPersonFromFixtures(); $person = $this->getPersonFromFixtures();
$activities = $this->getActivitiesForPerson($person); $activities = $this->getActivitiesForPerson($person);
@@ -63,7 +57,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
public function getSecuredPagesUnauthenticated() public function getSecuredPagesUnauthenticated()
{ {
self::bootKernel(); static::bootKernel();
$person = $this->getPersonFromFixtures(); $person = $this->getPersonFromFixtures();
$activities = $this->getActivitiesForPerson($person); $activities = $this->getActivitiesForPerson($person);
@@ -86,8 +80,8 @@ final class ActivityControllerTest extends WebTestCase
$client->request('GET', $url); $client->request('GET', $url);
self::assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
self::assertTrue( $this->assertTrue(
$client->getResponse()->isRedirect('http://localhost/login'), $client->getResponse()->isRedirect('http://localhost/login'),
sprintf('the page "%s" does not redirect to http://localhost/login', $url) sprintf('the page "%s" does not redirect to http://localhost/login', $url)
); );
@@ -103,7 +97,7 @@ final class ActivityControllerTest extends WebTestCase
{ {
$client->request('GET', $url); $client->request('GET', $url);
self::assertEquals(403, $client->getResponse()->getStatusCode()); $this->assertEquals(403, $client->getResponse()->getStatusCode());
} }
public function testCompleteScenario() public function testCompleteScenario()
@@ -117,7 +111,7 @@ final class ActivityControllerTest extends WebTestCase
'en/person/%d/activity/', 'en/person/%d/activity/',
$person->getId() $person->getId()
)); ));
self::assertEquals( $this->assertEquals(
200, 200,
$client->getResponse()->getStatusCode(), $client->getResponse()->getStatusCode(),
'Unexpected HTTP status code for GET /activity/' 'Unexpected HTTP status code for GET /activity/'
@@ -142,11 +136,11 @@ final class ActivityControllerTest extends WebTestCase
$client->submit($form); $client->submit($form);
self::assertTrue($client->getResponse()->isRedirect()); $this->assertTrue($client->getResponse()->isRedirect());
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
// Check data in the show view // Check data in the show view
self::assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler->filter('dd:contains("January 15, 2015")')->count(), $crawler->filter('dd:contains("January 15, 2015")')->count(),
'Missing element dd:contains("January 15, 2015")' 'Missing element dd:contains("January 15, 2015")'
@@ -164,17 +158,17 @@ final class ActivityControllerTest extends WebTestCase
$client->submit($form); $client->submit($form);
self::assertTrue($client->getResponse()->isRedirect()); $this->assertTrue($client->getResponse()->isRedirect());
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
// check that new data are present // check that new data are present
self::assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler->filter('dd:contains("January 25, 2015")')->count(), $crawler->filter('dd:contains("January 25, 2015")')->count(),
'Missing element dd:contains("January 25, 2015")' 'Missing element dd:contains("January 25, 2015")'
); );
self::assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler->filter('dd:contains("Foo")')->count(), $crawler->filter('dd:contains("Foo")')->count(),
'Missing element dd:contains("Foo")' 'Missing element dd:contains("Foo")'
@@ -188,14 +182,14 @@ final class ActivityControllerTest extends WebTestCase
$form = $button->form(); $form = $button->form();
$client->submit($form); $client->submit($form);
self::assertTrue($client->getResponse()->isRedirect(sprintf( $this->assertTrue($client->getResponse()->isRedirect(sprintf(
'/en/person/%d/activity/', '/en/person/%d/activity/',
$person->getId() $person->getId()
))); )));
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
self::assertNotContains('January 25, 2015', $crawler->text()); $this->assertNotContains('January 25, 2015', $crawler->text());
} }
/** /**
@@ -206,7 +200,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function createFakeUser() private function createFakeUser()
{ {
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$em = $container->get('doctrine.orm.entity_manager'); $em = $container->get('doctrine.orm.entity_manager');
//get the social PermissionGroup, and remove CHILL_ACTIVITY_* //get the social PermissionGroup, and remove CHILL_ACTIVITY_*
@@ -248,7 +242,7 @@ final class ActivityControllerTest extends WebTestCase
private function getActivitiesForPerson(\Chill\PersonBundle\Entity\Person $person) private function getActivitiesForPerson(\Chill\PersonBundle\Entity\Person $person)
{ {
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
$activities = $em->getRepository('ChillActivityBundle:Activity') $activities = $em->getRepository('ChillActivityBundle:Activity')
@@ -269,7 +263,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function getAuthenticatedClient($username = 'center a_social') private function getAuthenticatedClient($username = 'center a_social')
{ {
return self::createClient([], [ return static::createClient([], [
'PHP_AUTH_USER' => $username, 'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => 'password', 'PHP_AUTH_PW' => 'password',
]); ]);
@@ -280,7 +274,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function getPersonFromFixtures() private function getPersonFromFixtures()
{ {
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
$person = $em->getRepository('ChillPersonBundle:Person') $person = $em->getRepository('ChillPersonBundle:Person')
@@ -304,14 +298,14 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function getRandomActivityReason(array $excludeIds = []) private function getRandomActivityReason(array $excludeIds = [])
{ {
$reasons = self::$kernel->getContainer() $reasons = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('ChillActivityBundle:ActivityReason') ->getRepository('ChillActivityBundle:ActivityReason')
->findAll(); ->findAll();
$reason = $reasons[array_rand($reasons)]; $reason = $reasons[array_rand($reasons)];
if (in_array($reason->getId(), $excludeIds, true)) { if (in_array($reason->getId(), $excludeIds)) {
return $this->getRandomActivityReason($excludeIds); return $this->getRandomActivityReason($excludeIds);
} }
@@ -323,7 +317,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function getRandomActivityType() private function getRandomActivityType()
{ {
$types = self::$kernel->getContainer() $types = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('ChillActivityBundle:ActivityType') ->getRepository('ChillActivityBundle:ActivityType')
->findAll(); ->findAll();
@@ -339,7 +333,7 @@ final class ActivityControllerTest extends WebTestCase
*/ */
private function getRandomScope($username, $centerName) private function getRandomScope($username, $centerName)
{ {
$user = self::$kernel->getContainer() $user = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User') ->getRepository('ChillMainBundle:User')
->findOneByUsername($username); ->findOneByUsername($username);
@@ -349,20 +343,20 @@ final class ActivityControllerTest extends WebTestCase
. 'does not exists in database. Did you add fixtures ?'); . 'does not exists in database. Did you add fixtures ?');
} }
$center = self::$kernel->getContainer() $center = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:Center') ->getRepository('ChillMainBundle:Center')
->findOneByName($centerName); ->findOneByName($centerName);
// get scope reachable by both role UPDATE and DELETE // get scope reachable by both role UPDATE and DELETE
$reachableScopesUpdate = self::$kernel->getContainer() $reachableScopesUpdate = static::$kernel->getContainer()
->get('chill.main.security.authorization.helper') ->get('chill.main.security.authorization.helper')
->getReachableScopes( ->getReachableScopes(
$user, $user,
new Role('CHILL_ACTIVITY_UPDATE'), new Role('CHILL_ACTIVITY_UPDATE'),
$center $center
); );
$reachableScopesDelete = self::$kernel->getContainer() $reachableScopesDelete = static::$kernel->getContainer()
->get('chill.main.security.authorization.helper') ->get('chill.main.security.authorization.helper')
->getReachableScopes( ->getReachableScopes(
$user, $user,
@@ -370,8 +364,8 @@ final class ActivityControllerTest extends WebTestCase
$center $center
); );
$reachableScopesId = array_intersect( $reachableScopesId = array_intersect(
array_map(static function ($s) { return $s->getId(); }, $reachableScopesDelete), array_map(function ($s) { return $s->getId(); }, $reachableScopesDelete),
array_map(static function ($s) { return $s->getId(); }, $reachableScopesUpdate) array_map(function ($s) { return $s->getId(); }, $reachableScopesUpdate)
); );
if (count($reachableScopesId) === 0) { if (count($reachableScopesId) === 0) {
@@ -380,7 +374,7 @@ final class ActivityControllerTest extends WebTestCase
} }
foreach ($reachableScopesUpdate as $scope) { foreach ($reachableScopesUpdate as $scope) {
if (in_array($scope->getId(), $reachableScopesId, true)) { if (in_array($scope->getId(), $reachableScopesId)) {
$reachableScopes[] = $scope; $reachableScopes[] = $scope;
} }
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Controller; namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -19,11 +15,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityReasonCategoryControllerTest extends WebTestCase class ActivityReasonCategoryControllerTest extends WebTestCase
{ {
public function testToWrite() public function testToWrite()
{ {
self::markTestSkipped(); $this->markTestSkipped();
} }
/* /*

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Controller; namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -19,11 +15,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityReasonControllerTest extends WebTestCase class ActivityReasonControllerTest extends WebTestCase
{ {
public function testToWrite() public function testToWrite()
{ {
self::markTestSkipped(); $this->markTestSkipped();
} }
/* /*

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Controller; namespace Chill\ActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -19,11 +15,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityTypeControllerTest extends WebTestCase class ActivityTypeControllerTest extends WebTestCase
{ {
public function testToWrite() public function testToWrite()
{ {
self::markTestSkipped(); $this->markTestSkipped();
} }
/* /*

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Aggregator; namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -21,18 +17,18 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityReasonAggregatorTest extends AbstractAggregatorTest class ActivityReasonAggregatorTest extends AbstractAggregatorTest
{ {
/** /**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator * @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
*/ */
private $aggregator; private $aggregator;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.reason_aggregator'); $this->aggregator = $container->get('chill.activity.export.reason_aggregator');
@@ -61,11 +57,11 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders() public function getQueryBuilders()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
return [ return [

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Aggregator; namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -21,18 +17,18 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityTypeAggregatorTest extends AbstractAggregatorTest class ActivityTypeAggregatorTest extends AbstractAggregatorTest
{ {
/** /**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator * @var \Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
*/ */
private $aggregator; private $aggregator;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.type_aggregator'); $this->aggregator = $container->get('chill.activity.export.type_aggregator');
@@ -60,11 +56,11 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders() public function getQueryBuilders()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
return [ return [

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Aggregator; namespace Chill\ActivityBundle\Tests\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest; use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
@@ -21,18 +17,18 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityUserAggregatorTest extends AbstractAggregatorTest class ActivityUserAggregatorTest extends AbstractAggregatorTest
{ {
/** /**
* @var \Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator * @var \Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
*/ */
private $aggregator; private $aggregator;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.activity.export.user_aggregator'); $this->aggregator = $container->get('chill.activity.export.user_aggregator');
@@ -60,11 +56,11 @@ final class ActivityUserAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders() public function getQueryBuilders()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
return [ return [

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export; namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest; use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -19,18 +15,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class CountActivityTest extends AbstractExportTest class CountActivityTest extends AbstractExportTest
{ {
/** /**
* @var * @var
*/ */
private $export; private $export;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
$container = self::$kernel->getContainer(); $container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.count_activity'); $this->export = $container->get('chill.activity.export.count_activity');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export; namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest; use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -19,18 +15,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ListActivityTest extends AbstractExportTest class ListActivityTest extends AbstractExportTest
{ {
/** /**
* @var \Chill\ActivityBundle\Export\Export\ListActivity * @var \Chill\ActivityBundle\Export\Export\ListActivity
*/ */
private $export; private $export;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
$container = self::$kernel->getContainer(); $container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.list_activity'); $this->export = $container->get('chill.activity.export.list_activity');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export; namespace Chill\ActivityBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest; use Chill\MainBundle\Test\Export\AbstractExportTest;
@@ -21,18 +17,18 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class StatActivityDurationSumTest extends AbstractExportTest class StatActivityDurationSumTest extends AbstractExportTest
{ {
/** /**
* @var \Chill\ActivityBundle\Export\Export\StatActivityDuration * @var \Chill\ActivityBundle\Export\Export\StatActivityDuration
*/ */
private $export; private $export;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */ /* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
$container = self::$kernel->getContainer(); $container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.sum_activity_duration'); $this->export = $container->get('chill.activity.export.sum_activity_duration');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Filter; namespace Chill\ActivityBundle\Tests\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\MainBundle\Test\Export\AbstractFilterTest;
@@ -20,18 +16,18 @@ use Doctrine\Common\Collections\ArrayCollection;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityReasonFilterTest extends AbstractFilterTest class ActivityReasonFilterTest extends AbstractFilterTest
{ {
/** /**
* @var \Chill\PersonBundle\Export\Filter\GenderFilter * @var \Chill\PersonBundle\Export\Filter\GenderFilter
*/ */
private $filter; private $filter;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$this->filter = $container->get('chill.activity.export.reason_filter'); $this->filter = $container->get('chill.activity.export.reason_filter');
@@ -52,11 +48,11 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
public function getFormData() public function getFormData()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
$reasons = $em->createQuery('SELECT reason ' $reasons = $em->createQuery('SELECT reason '
@@ -73,11 +69,11 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
public function getQueryBuilders() public function getQueryBuilders()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
return [ return [

View File

@@ -1,38 +1,33 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Filter; namespace Chill\ActivityBundle\Tests\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\MainBundle\Test\Export\AbstractFilterTest;
use DateTime; use DateTime;
use function array_slice;
/** /**
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
{ {
/** /**
* @var \Chill\PersonBundle\Export\Filter\PersonHavingActivityBetweenDateFilter * @var \Chill\PersonBundle\Export\Filter\PersonHavingActivityBetweenDateFilter
*/ */
private $filter; private $filter;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$container = self::$kernel->getContainer(); $container = static::$kernel->getContainer();
$this->filter = $container->get('chill.activity.export.' $this->filter = $container->get('chill.activity.export.'
. 'person_having_an_activity_between_date_filter'); . 'person_having_an_activity_between_date_filter');
@@ -73,11 +68,11 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
public function getQueryBuilders() public function getQueryBuilders()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
$em = self::$kernel->getContainer() $em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
return [ return [
@@ -102,11 +97,11 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
*/ */
private function getActivityReasons() private function getActivityReasons()
{ {
if (null === self::$kernel) { if (null === static::$kernel) {
self::bootKernel(); static::bootKernel();
} }
return self::$kernel->getContainer() return static::$kernel->getContainer()
->get('chill_activity.repository.reason') ->get('chill_activity.repository.reason')
->findAll(); ->findAll();
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Form; namespace Chill\ActivityBundle\Tests\Form;
use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Entity\Activity;
@@ -25,7 +21,7 @@ use Symfony\Component\Security\Core\Role\Role;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityTypeTest extends KernelTestCase class ActivityTypeTest extends KernelTestCase
{ {
/** /**
* @var \Chill\MainBundle\Entity\Center * @var \Chill\MainBundle\Entity\Center
@@ -47,7 +43,7 @@ final class ActivityTypeTest extends KernelTestCase
*/ */
protected $user; protected $user;
protected function setUp() public function setUp()
{ {
self::bootKernel(); self::bootKernel();
@@ -93,9 +89,9 @@ final class ActivityTypeTest extends KernelTestCase
$form->submit([]); $form->submit([]);
self::assertTrue($form->isSynchronized()); $this->assertTrue($form->isSynchronized());
self::assertTrue($form->isValid()); $this->assertTrue($form->isValid());
self::assertInstanceOf(Activity::class, $form->getData()['activity']); $this->assertInstanceOf(Activity::class, $form->getData()['activity']);
} }
public function testFormSubmitting() public function testFormSubmitting()
@@ -118,25 +114,25 @@ final class ActivityTypeTest extends KernelTestCase
// foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); } // foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); }
// var_dump($form->getErrors()); // var_dump($form->getErrors());
self::assertTrue($form->isSynchronized(), 'Test the form is synchronized'); $this->assertTrue($form->isSynchronized(), 'Test the form is synchronized');
self::assertTrue($form->isValid(), 'test the form is valid'); $this->assertTrue($form->isValid(), 'test the form is valid');
self::assertInstanceOf(Activity::class, $form->getData()['activity']); $this->assertInstanceOf(Activity::class, $form->getData()['activity']);
// test the activity // test the activity
/** @var Activity $activity */ /* @var $activity Activity */
$activity = $form->getData()['activity']; $activity = $form->getData()['activity'];
self::assertEquals( $this->assertEquals(
'09-03-2015', '09-03-2015',
$activity->getDate()->format('d-m-Y'), $activity->getDate()->format('d-m-Y'),
'Test the date is correct' 'Test the date is correct'
); );
self::assertEquals( $this->assertEquals(
'00:05', '00:05',
$activity->getDurationTime()->format('H:i'), $activity->getDurationTime()->format('H:i'),
'Test the formatted hour is correct' 'Test the formatted hour is correct'
); );
self::assertTrue($activity->getAttendee()); $this->assertEquals(true, $activity->getAttendee());
// $this->assertEquals('blabla', $activity->getRemark()); // $this->assertEquals('blabla', $activity->getRemark());
} }
@@ -170,14 +166,14 @@ final class ActivityTypeTest extends KernelTestCase
'attendee' => true, 'attendee' => true,
]]); ]]);
self::assertTrue($form->isSynchronized()); $this->assertTrue($form->isSynchronized());
self::assertTrue($form->isValid()); $this->assertTrue($form->isValid());
// test the activity // test the activity
/** @var Activity $activity */ /* @var $activity Activity */
$activity = $form->getData()['activity']; $activity = $form->getData()['activity'];
self::assertEquals( $this->assertEquals(
'00:01', '00:01',
$activity->getDurationTime()->format('H:i'), $activity->getDurationTime()->format('H:i'),
'Test the formatted hour is correct' 'Test the formatted hour is correct'
@@ -186,14 +182,14 @@ final class ActivityTypeTest extends KernelTestCase
// test the view : we want to be sure that the entry with 60 seconds exists // test the view : we want to be sure that the entry with 60 seconds exists
$view = $form->createView(); $view = $form->createView();
self::assertTrue(isset($view['activity']['durationTime'])); $this->assertTrue(isset($view['activity']['durationTime']));
// map all the values in an array // map all the values in an array
$values = array_map( $values = array_map(
static function ($choice) { return $choice->value; }, function ($choice) { return $choice->value; },
$view['activity']['durationTime']->vars['choices'] $view['activity']['durationTime']->vars['choices']
); );
self::assertContains(60, $values); $this->assertContains(60, $values);
} }
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Form\Type; namespace Chill\ActivityBundle\Tests\Form\Type;
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason; use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
@@ -24,14 +20,14 @@ use Symfony\Component\Form\Test\TypeTestCase;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class TranslatableActivityReasonTest extends TypeTestCase class TranslatableActivityReasonTest extends TypeTestCase
{ {
/** /**
* @var Prophecy\Prophet * @var Prophecy\Prophet
*/ */
private static $prophet; private static $prophet;
protected function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
} }
@@ -42,7 +38,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
$this->getTranslatableStringHelper() $this->getTranslatableStringHelper()
); );
self::markTestSkipped('See issue 651'); $this->markTestSkipped('See issue 651');
} }
/** /**
@@ -85,7 +81,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
$request->getLocale()->willReturn($fallbackLocale); $request->getLocale()->willReturn($fallbackLocale);
$requestStack->willExtend('Symfony\Component\HttpFoundation\RequestStack'); $requestStack->willExtend('Symfony\Component\HttpFoundation\RequestStack');
$requestStack->getCurrentRequest()->will(static function () use ($request) { $requestStack->getCurrentRequest()->will(function () use ($request) {
return $request; return $request;
}); });

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Form\Type; namespace Chill\ActivityBundle\Tests\Form\Type;
use Chill\ActivityBundle\Form\Type\TranslatableActivityType; use Chill\ActivityBundle\Form\Type\TranslatableActivityType;
@@ -21,7 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class TranslatableActivityTypeTest extends KernelTestCase class TranslatableActivityTypeTest extends KernelTestCase
{ {
/** /**
* @var \Symfony\Component\Form\FormBuilderInterface * @var \Symfony\Component\Form\FormBuilderInterface
@@ -33,7 +29,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
*/ */
protected $container; protected $container;
protected function setUp() public function setUp()
{ {
self::bootKernel(); self::bootKernel();
@@ -63,13 +59,13 @@ final class TranslatableActivityTypeTest extends KernelTestCase
'type' => $type->getId(), 'type' => $type->getId(),
]); ]);
self::assertTrue($form->isSynchronized()); $this->assertTrue($form->isSynchronized());
self::assertInstanceOf( $this->assertInstanceOf(
\Chill\ActivityBundle\Entity\ActivityType::class, \Chill\ActivityBundle\Entity\ActivityType::class,
$form->getData()['type'], $form->getData()['type'],
'The data is an instance of Chill\\ActivityBundle\\Entity\\ActivityType' 'The data is an instance of Chill\\ActivityBundle\\Entity\\ActivityType'
); );
self::assertEquals($type->getId(), $form->getData()['type']->getId()); $this->assertEquals($type->getId(), $form->getData()['type']->getId());
// test the ordering of the types in the form // test the ordering of the types in the form
// since 2016-11-14 the types are not alphabetically ordered, skipping // since 2016-11-14 the types are not alphabetically ordered, skipping

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Security\Authorization; namespace Chill\ActivityBundle\Tests\Security\Authorization;
use Chill\ActivityBundle\Test\PrepareActivityTrait; use Chill\ActivityBundle\Test\PrepareActivityTrait;
@@ -28,7 +24,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class ActivityVoterTest extends KernelTestCase class ActivityVoterTest extends KernelTestCase
{ {
use PrepareActivityTrait; use PrepareActivityTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
@@ -46,10 +42,10 @@ final class ActivityVoterTest extends KernelTestCase
*/ */
protected $voter; protected $voter;
protected function setUp() public function setUp()
{ {
self::bootKernel(); static::bootKernel();
$this->voter = self::$kernel->getContainer() $this->voter = static::$kernel->getContainer()
->get('chill.activity.security.authorization.activity_voter'); ->get('chill.activity.security.authorization.activity_voter');
$this->prophet = new \Prophecy\Prophet(); $this->prophet = new \Prophecy\Prophet();
} }
@@ -115,7 +111,7 @@ final class ActivityVoterTest extends KernelTestCase
$scope = $this->prepareScope(1, 'default'); $scope = $this->prepareScope(1, 'default');
$activity = $this->prepareActivity($scope, $person); $activity = $this->prepareActivity($scope, $person);
self::assertEquals( $this->assertEquals(
VoterInterface::ACCESS_DENIED, VoterInterface::ACCESS_DENIED,
$this->voter->vote($token, $activity, ['CHILL_ACTIVITY_SEE']), $this->voter->vote($token, $activity, ['CHILL_ACTIVITY_SEE']),
'assert that a null user is not allowed to see' 'assert that a null user is not allowed to see'
@@ -140,7 +136,7 @@ final class ActivityVoterTest extends KernelTestCase
$token = $this->prepareToken($user); $token = $this->prepareToken($user);
$activity = $this->prepareActivity($scope, $this->preparePerson($center)); $activity = $this->prepareActivity($scope, $this->preparePerson($center));
self::assertEquals( $this->assertEquals(
$expectedResult, $expectedResult,
$this->voter->vote($token, $activity, [$attribute]), $this->voter->vote($token, $activity, [$attribute]),
$message $message

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Timeline; namespace Chill\ActivityBundle\Tests\Timeline;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -19,10 +15,10 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal * @internal
* @coversNothing * @coversNothing
*/ */
final class TimelineProviderTest extends WebTestCase class TimelineProviderTest extends WebTestCase
{ {
public function testAnActivityIsShownOnTimeline() public function testAnActivityIsShownOnTimeline()
{ {
self::markTestSkipped('we have to write fixtures before writing this tests'); $this->markTestSkipped('we have to write fixtures before writing this tests');
} }
} }

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\ActivityBundle\Timeline; namespace Chill\ActivityBundle\Timeline;
use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\Scope;
@@ -24,8 +20,6 @@ use RuntimeException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use function count;
/** /**
* Provide activity for inclusion in timeline. * Provide activity for inclusion in timeline.
*/ */
@@ -64,9 +58,6 @@ class TimelineActivityProvider implements TimelineProviderInterface
$this->user = $storage->getToken()->getUser(); $this->user = $storage->getToken()->getUser();
} }
/**
* {@inheritdoc}
*/
public function fetchQuery($context, array $args) public function fetchQuery($context, array $args)
{ {
$this->checkContext($context); $this->checkContext($context);
@@ -89,9 +80,6 @@ class TimelineActivityProvider implements TimelineProviderInterface
]; ];
} }
/**
* {@inheritdoc}
*/
public function getEntities(array $ids) public function getEntities(array $ids)
{ {
$activities = $this->em->getRepository('ChillActivityBundle:Activity') $activities = $this->em->getRepository('ChillActivityBundle:Activity')
@@ -106,9 +94,6 @@ class TimelineActivityProvider implements TimelineProviderInterface
return $result; return $result;
} }
/**
* {@inheritdoc}
*/
public function getEntityTemplate($entity, $context, array $args) public function getEntityTemplate($entity, $context, array $args)
{ {
$this->checkContext($context); $this->checkContext($context);
@@ -123,9 +108,6 @@ class TimelineActivityProvider implements TimelineProviderInterface
]; ];
} }
/**
* {@inheritdoc}
*/
public function supportsType($type) public function supportsType($type)
{ {
return 'activity' === $type; return 'activity' === $type;
@@ -189,7 +171,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
foreach ($reachableCenters as $center) { foreach ($reachableCenters as $center) {
$reachablesScopesId = array_map( $reachablesScopesId = array_map(
static function (Scope $scope) { function (Scope $scope) {
return $scope->getId(); return $scope->getId();
}, },
$this->helper->getReachableScopes( $this->helper->getReachableScopes(

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\Migrations\Activity; namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
@@ -24,7 +20,7 @@ class Version20150701091248 extends AbstractMigration
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity DROP CONSTRAINT FK_55026B0C59BB1592'); $this->addSql('ALTER TABLE Activity DROP CONSTRAINT FK_55026B0C59BB1592');
$this->addSql('ALTER TABLE ActivityReason DROP CONSTRAINT FK_654A2FCD12469DE2'); $this->addSql('ALTER TABLE ActivityReason DROP CONSTRAINT FK_654A2FCD12469DE2');
@@ -42,7 +38,7 @@ class Version20150701091248 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE Activity_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE Activity_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE ActivityReason_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE ActivityReason_id_seq INCREMENT BY 1 MINVALUE 1 START 1');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\Migrations\Activity; namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
@@ -24,7 +20,7 @@ class Version20150702093317 extends AbstractMigration
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN name;'); $this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN name;');
$this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN label VARCHAR(255) NOT NULL;'); $this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN label VARCHAR(255) NOT NULL;');
@@ -37,7 +33,7 @@ class Version20150702093317 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN label;'); $this->addSql('ALTER TABLE ActivityReasonCategory DROP COLUMN label;');
$this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN name JSON;'); $this->addSql('ALTER TABLE ActivityReasonCategory ADD COLUMN name JSON;');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\Migrations\Activity; namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
@@ -24,7 +20,7 @@ class Version20150704091347 extends AbstractMigration
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity ALTER COLUMN remark SET NOT NULL;'); $this->addSql('ALTER TABLE Activity ALTER COLUMN remark SET NOT NULL;');
$this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;'); $this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;');
@@ -33,7 +29,7 @@ class Version20150704091347 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.'); $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE Activity ALTER COLUMN remark DROP NOT NULL;'); $this->addSql('ALTER TABLE Activity ALTER COLUMN remark DROP NOT NULL;');
$this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;'); $this->addSql('ALTER TABLE Activity ALTER COLUMN attendee DROP NOT NULL;');

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\Migrations\Activity; namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
@@ -27,7 +23,7 @@ class Version20160222103457 extends AbstractMigration
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
$this->abortIf( $this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'postgresql', $this->connection->getDatabasePlatform()->getName() != 'postgresql',
'Migration can only be executed safely on \'postgresql\'.' 'Migration can only be executed safely on \'postgresql\'.'
); );
@@ -39,7 +35,7 @@ class Version20160222103457 extends AbstractMigration
// try to keep at least on activity reason... // try to keep at least on activity reason...
$this->addSql( $this->addSql(
'UPDATE activity 'UPDATE activity
SET reason_id=rid SET reason_id=rid
FROM ( FROM (
SELECT activity_id AS aid, MIN(activityreason_id) AS rid SELECT activity_id AS aid, MIN(activityreason_id) AS rid
@@ -54,7 +50,7 @@ class Version20160222103457 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
$this->abortIf( $this->abortIf(
$this->connection->getDatabasePlatform()->getName() !== 'postgresql', $this->connection->getDatabasePlatform()->getName() != 'postgresql',
'Migration can only be executed safely on \'postgresql\'.' 'Migration can only be executed safely on \'postgresql\'.'
); );

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\Migrations\Activity; namespace Chill\Migrations\Activity;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;

View File

@@ -1,12 +1,10 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1); declare(strict_types=1);

View File

@@ -1,12 +1,10 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1); declare(strict_types=1);

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator; namespace Chill\AMLI\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement; use Chill\AMLI\BudgetBundle\Entity\AbstractElement;

View File

@@ -1,22 +1,20 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator; namespace Chill\AMLI\BudgetBundle\Calculator;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement; use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
use OutOfBoundsException; use OutOfBoundsException;
use function array_key_exists; use function array_key_exists;
use function array_keys;
use function implode;
class CalculatorManager class CalculatorManager
{ {

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Calculator; namespace Chill\AMLI\BudgetBundle\Calculator;
class CalculatorResult class CalculatorResult

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle; namespace Chill\AMLI\BudgetBundle;
use Chill\AMLI\BudgetBundle\DependencyInjection\Compiler\CalculatorCompilerPass; use Chill\AMLI\BudgetBundle\DependencyInjection\Compiler\CalculatorCompilerPass;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Config; namespace Chill\AMLI\BudgetBundle\Config;
class ConfigRepository class ConfigRepository

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller; namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\AbstractElement; use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
@@ -24,8 +20,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use function get_class;
abstract class AbstractElementController extends Controller abstract class AbstractElementController extends Controller
{ {
/** /**
@@ -117,7 +111,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() and $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->flush(); $em->flush();
@@ -141,7 +135,7 @@ abstract class AbstractElementController extends Controller
*/ */
protected function _new(Person $person, Request $request, $template, $flashMessageOnSuccess) protected function _new(Person $person, Request $request, $template, $flashMessageOnSuccess)
{ {
/** @var \Chill\AMLI\BudgetBundle\Entity\AbstractElement $element */ /* @var $element \Chill\AMLI\BudgetBundle\Entity\AbstractElement */
$element = $this->createNewElement() $element = $this->createNewElement()
->setPerson($person); ->setPerson($person);
@@ -152,7 +146,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() and $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($element); $em->persist($element);
$em->flush(); $em->flush();

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller; namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Charge; use Chill\AMLI\BudgetBundle\Entity\Charge;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller; namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager; use Chill\AMLI\BudgetBundle\Calculator\CalculatorManager;
@@ -25,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use function count; use function array_merge;
class ElementController extends Controller class ElementController extends Controller
{ {

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\Controller; namespace Chill\AMLI\BudgetBundle\Controller;
use Chill\AMLI\BudgetBundle\Entity\Resource; use Chill\AMLI\BudgetBundle\Entity\Resource;

View File

@@ -1,16 +1,12 @@
<?php <?php
/** /**
* Chill is a software for social workers. * Chill is a software for social workers
* *
* For the full copyright and license information, please view * For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code. * the LICENSE file that was distributed with this source code.
*
* @see https://www.champs-libres.coop/
*/ */
declare(strict_types=1);
namespace Chill\AMLI\BudgetBundle\DependencyInjection; namespace Chill\AMLI\BudgetBundle\DependencyInjection;
use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter; use Chill\AMLI\BudgetBundle\Security\Authorization\BudgetElementVoter;
@@ -27,9 +23,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/ */
class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInterface class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInterface
{ {
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container) public function load(array $configs, ContainerBuilder $container)
{ {
$configuration = new Configuration(); $configuration = new Configuration();
@@ -54,7 +47,7 @@ class ChillAMLIBudgetExtension extends Extension implements PrependExtensionInte
$this->prependRoutes($container); $this->prependRoutes($container);
} }
/** (non-PHPdoc). /* (non-PHPdoc)
* @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend() * @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface::prepend()
*/ */
public function prependRoutes(ContainerBuilder $container) public function prependRoutes(ContainerBuilder $container)

Some files were not shown because too many files have changed in this diff Show More