mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-18 09:57:46 +00:00
Compare commits
330 Commits
386-chill-
...
ticket/64-
| Author | SHA1 | Date | |
|---|---|---|---|
|
6d3bcf48b5
|
|||
|
7136c682f2
|
|||
|
625e55056d
|
|||
|
6d617146b8
|
|||
| 65bbdc283d | |||
|
|
f0b3e63d66 | ||
|
14e0cba2e8
|
|||
| 41a31944b3 | |||
| 51607572de | |||
|
627e128977
|
|||
| 1fc5530707 | |||
|
|
b31778c068 | ||
|
305c6deb24
|
|||
|
d691098a21
|
|||
|
3f6bbbc1b3
|
|||
|
31e57d7507
|
|||
|
5c098a336d
|
|||
|
e107d20bea
|
|||
|
491fd81f9b
|
|||
|
8c2acbd166
|
|||
|
e291c7abec
|
|||
|
1e186fab58
|
|||
|
83a2c04537
|
|||
|
e89b33bc1a
|
|||
|
6b208e9962
|
|||
|
b0c63fab91
|
|||
|
6d4c4d2c74
|
|||
|
df6087d468
|
|||
|
ffac143ab9
|
|||
|
f1bf6023ff
|
|||
|
71e146e4f0
|
|||
|
4234377b7e
|
|||
|
1be82b3049
|
|||
|
808954df42
|
|||
|
3f8bb6c5c0
|
|||
|
23e1a0d36a
|
|||
|
a594d86346
|
|||
|
870907804b
|
|||
|
e9e6c05e3d
|
|||
|
532f2dd842
|
|||
|
d14d4d4d8f
|
|||
| a22cbe0239 | |||
| 98902bdeb8 | |||
|
592a0f3698
|
|||
|
d469eb19ad
|
|||
| 4765d4fe28 | |||
|
|
30bcb85549 | ||
|
189a9337b4
|
|||
|
c030232a73
|
|||
|
d4f9726f90
|
|||
|
8740025dbd
|
|||
|
6d8ef035ea
|
|||
|
60eab628ee
|
|||
|
1fd559b722
|
|||
|
b526e802d7
|
|||
|
60937152c3
|
|||
|
6d2e78ce55
|
|||
|
e566f60a4a
|
|||
|
c06531cddb
|
|||
| 61ca700bbe | |||
|
|
b43aeebc3c | ||
| 056e2dcc5f | |||
| e57d1ac696 | |||
|
4a1da25fee
|
|||
| 0eff1d2e79 | |||
| 3928b2cc7a | |||
|
02783e5391
|
|||
|
4f51ef81ad
|
|||
|
4637dc692c
|
|||
|
be3b9f0f56
|
|||
|
ee006f55d6
|
|||
|
13b1c45271
|
|||
|
ad2b6d63ac
|
|||
|
bfbde078b7
|
|||
|
d42a1296c4
|
|||
|
4b7e3c1601
|
|||
|
6ea9af588b
|
|||
|
0fd76d3fa8
|
|||
|
34af53130b
|
|||
|
a1fd395868
|
|||
|
b8a7cbb321
|
|||
|
6124eb9e34
|
|||
|
a5b06de92a
|
|||
|
52404956d2
|
|||
|
4207efd6bf
|
|||
|
840fde4ad4
|
|||
|
3611ea2518
|
|||
|
bbd4292cb9
|
|||
|
54f8c92240
|
|||
|
5330befc8f
|
|||
|
c19206be0c
|
|||
|
5ff374d2fa
|
|||
|
4a73aaae94
|
|||
|
ff2c567d05
|
|||
|
a734e84f28
|
|||
|
4367ed086e
|
|||
|
3227bfcd3a
|
|||
|
8d29fb260a
|
|||
|
bda0743c63
|
|||
|
d9b730627f
|
|||
|
27548ad654
|
|||
|
bec7297039
|
|||
|
852523e644
|
|||
|
c05d0aad47
|
|||
|
1c0ed9abc8
|
|||
|
9aed5cc216
|
|||
|
e4fe5bff68
|
|||
|
4c73c4d9d0
|
|||
| 38935edb93 | |||
|
|
e1ef65d4ca | ||
| ec9d0be70b | |||
|
|
0ba2cbc1e8 | ||
| e87429933a | |||
|
8e2e676e3d
|
|||
| e12ad563a3 | |||
|
|
711aa8db9b | ||
| e78d44953f | |||
| 18f67801c7 | |||
|
c815e6bc69
|
|||
| 807f2711fe | |||
|
|
cd594cd580 | ||
|
fb6b26bfb5
|
|||
|
c5cedb8bd6
|
|||
|
2665e43a61
|
|||
|
25561cdf63
|
|||
| 10b73e06e1 | |||
|
|
e7c04e34a9 | ||
| 164beee7c6 | |||
|
|
4d96eb9457 | ||
| fe2eba3b29 | |||
|
|
61d1232e31 | ||
| 6594d4f6a6 | |||
| 1a66a9e864 | |||
| 1b74c119dc | |||
| 14d88810f3 | |||
| 445a2c9358 | |||
| c8baf0a8aa | |||
| faed443a96 | |||
| bbf387d96f | |||
|
|
b7c9b60744 | ||
|
2bd303bbbe
|
|||
|
c5e6122d2c
|
|||
| 088b876e20 | |||
| 3400656d7c | |||
|
568c8be7fd
|
|||
|
538ecc42ea
|
|||
|
15d26d4b06
|
|||
|
d8bd9bd7cd
|
|||
|
dcdfba5ccd
|
|||
|
0204bdd38d
|
|||
|
392fd01b56
|
|||
| 35844f3b73 | |||
| 7506b918d7 | |||
| cfba291f2c | |||
|
|
04438c09d3 | ||
| 2a54d1b909 | |||
|
|
628eeac5e0 | ||
| a2263b3fa1 | |||
| 74796d0fb0 | |||
|
c19481e40a
|
|||
|
|
6eeb717b1a | ||
|
beb7c462da
|
|||
|
|
dbf363a9e8 | ||
|
64a2f7c9ed
|
|||
| f26d9739c8 | |||
|
afa5edc1d8
|
|||
|
42d6c9e672
|
|||
|
2b22d4cb7c
|
|||
|
c8e5d0eb37
|
|||
| 2bf8ad5d6c | |||
| 11698a52e3 | |||
| 70955573e8 | |||
|
|
3df4043eb9 | ||
|
06e8264dde
|
|||
| b451d2c4a3 | |||
| 4f93150874 | |||
| 0566ab0910 | |||
|
|
f4eeee1598 | ||
| 33cf16fc13 | |||
| 0a331aab37 | |||
| d43b739654 | |||
| c72432efae | |||
|
95975fae55
|
|||
|
95a7efa138
|
|||
|
45e193ff6d
|
|||
|
dfc146ff3f
|
|||
| b41fcf66a9 | |||
|
|
a8dd1b3548 | ||
|
2b99a480ac
|
|||
|
7633e587bb
|
|||
|
fc61dfdf3a
|
|||
|
f1a5b5c49e
|
|||
|
ec685dcd47
|
|||
|
631ae3eedd
|
|||
|
440a7837ac
|
|||
|
e0abf34784
|
|||
|
377ae9a9dc
|
|||
|
034dc30e30
|
|||
|
d615111a0f
|
|||
|
ffb756c712
|
|||
|
69daccb860
|
|||
|
16435423cf
|
|||
|
697b4ab436
|
|||
|
67d804e28e
|
|||
|
cf41fa9574
|
|||
|
b8b325f7d7
|
|||
|
e97bd8c4ef
|
|||
|
e28d7df533
|
|||
|
4b20b1bc01
|
|||
|
b15733076c
|
|||
|
25be5c9ea3
|
|||
|
b035020c6f
|
|||
|
128101dc46
|
|||
|
5f2711023e
|
|||
|
bdf2ed4bbd
|
|||
|
1df542603e
|
|||
|
80bcc68ce5
|
|||
|
154fc3e2f6
|
|||
|
e45af94c78
|
|||
|
166a6fde20
|
|||
|
631f047338
|
|||
|
a777588bb8
|
|||
|
ca78d112c2
|
|||
|
bcfd317d83
|
|||
|
348740f073
|
|||
|
0d74f0980f
|
|||
|
be19dc00db
|
|||
|
643028ffd6
|
|||
|
ac4e2e5bf2
|
|||
|
498572b96e
|
|||
|
d2a61ce69b
|
|||
|
a9c0567ee1
|
|||
|
76cec5b5a8
|
|||
|
efe8a67697
|
|||
|
26dfa9b028
|
|||
|
50025044d3
|
|||
|
e6202a2e34
|
|||
|
b863bd967d
|
|||
|
e65bcf7275
|
|||
|
e00ece4200
|
|||
|
640fd71402
|
|||
|
aae50ca290
|
|||
|
1fa483598b
|
|||
|
e4b6a468f8
|
|||
|
|
66c7758023 | ||
|
|
4750d2c24e | ||
|
|
ca05e3d979 | ||
|
|
a20f9b4f86 | ||
|
|
c73c1eb8d5 | ||
|
|
8778bb0731 | ||
|
|
c7d20eebc5 | ||
|
|
b9e130c159 | ||
|
|
3e8bc94af3 | ||
|
|
0c914c9f9f | ||
|
|
580a60c939 | ||
|
|
4996ac3b7c | ||
|
|
2a23bf19cb | ||
|
|
650d2596d9 | ||
|
|
2bdd5a329e | ||
|
78d1776733
|
|||
|
66dc603c85
|
|||
|
3a8154ecce
|
|||
|
c81828e04f
|
|||
|
|
ec17dd7de2 | ||
| 76c076a5f3 | |||
|
|
f0045edd6c | ||
|
|
d00b76ffcd | ||
|
|
8991f0ef3f | ||
|
|
d6f5eae0c9 | ||
|
|
821fce3dd8 | ||
|
|
1d33ae1e39 | ||
|
|
19af0feb57 | ||
|
|
1c09e9a692 | ||
|
|
d72e748388 | ||
|
|
ab850b7b70 | ||
|
|
3f9745d8cf | ||
|
|
473765366a | ||
|
|
6500c24a7f | ||
|
|
1d00457141 | ||
|
|
eb0bf56cff | ||
|
|
7b8cd90cf1 | ||
|
|
a27d92aba0 | ||
|
|
85bdfb9e21 | ||
|
|
4cffcf4de1 | ||
|
|
b2587a688f | ||
|
|
c9f0e9843b | ||
|
|
b40ad9e445 | ||
|
|
3e10e47e29 | ||
|
|
2a1963e993 | ||
| 34c171659b | |||
|
2d8b960d9e
|
|||
| 831ae03431 | |||
|
45828174d1
|
|||
|
ed45f14a45
|
|||
|
fa67835690
|
|||
|
b434d38091
|
|||
|
|
800a952532 | ||
|
9f355032a8
|
|||
|
0bc6e62d4d
|
|||
|
46fb1c04b5
|
|||
| 3b2c3d1464 | |||
|
|
0bd6038160 | ||
|
|
baab8e94ce | ||
|
e2deb55fdb
|
|||
|
|
2cdfb50058 | ||
|
39d701feb2
|
|||
|
613ee8b186
|
|||
|
56a1a488de
|
|||
| 3f789ad0f4 | |||
|
467bea7cde
|
|||
|
670b8eb82b
|
|||
|
a9760b323f
|
|||
|
71a3a1924a
|
|||
|
ecdc1e25bf
|
|||
|
dd37427be1
|
|||
|
c8467df1b1
|
|||
|
4c89a954fa
|
|||
|
7c1f3b114d
|
|||
|
36bc4dab24
|
|||
|
4b30d92282
|
|||
|
75fbec5489
|
|||
|
912fdd6349
|
|||
|
5832542978
|
|||
|
5c3585a1ed
|
|||
|
a2f1e20ddf
|
|||
|
4d67702a76
|
|||
| 18e442db29 | |||
|
|
deb3d92189 | ||
|
a59ea7db31
|
|||
|
a738b0cac9
|
7
.changes/unreleased/DX-20251027-150053.yaml
Normal file
7
.changes/unreleased/DX-20251027-150053.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
kind: DX
|
||||
body: |
|
||||
Send notifications log to dedicated channel, if it exists
|
||||
time: 2025-10-27T15:00:53.309372316+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
||||
@@ -1,6 +0,0 @@
|
||||
kind: DX
|
||||
body: Use mkdocs instead of sphinx to build chill developer documentation
|
||||
time: 2025-11-17T16:06:50.46185765+01:00
|
||||
custom:
|
||||
Issue: "386"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Feature-20240530-160003.yaml
Normal file
6
.changes/unreleased/Feature-20240530-160003.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: |
|
||||
Upgrade import of address list to the last version of compiled addresses of belgian-best-address
|
||||
time: 2024-05-30T16:00:03.440767606+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
6
.changes/unreleased/Feature-20240531-190242.yaml
Normal file
6
.changes/unreleased/Feature-20240531-190242.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: |
|
||||
Upgrade CKEditor and refactor configuration with use of typescript
|
||||
time: 2024-05-31T19:02:42.776662753+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
6
.changes/unreleased/Feature-20250808-120802.yaml
Normal file
6
.changes/unreleased/Feature-20250808-120802.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Create invitation list in user menu
|
||||
time: 2025-08-08T12:08:02.446361367+02:00
|
||||
custom:
|
||||
Issue: "385"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Feature-20251007-155945.yaml
Normal file
6
.changes/unreleased/Feature-20251007-155945.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Admin interface for Motive entity
|
||||
time: 2025-10-07T15:59:45.597029709+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Feature-20251022-111552.yaml
Normal file
6
.changes/unreleased/Feature-20251022-111552.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Add an admin interface for Motive entity
|
||||
time: 2025-10-22T11:15:52.13937955+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: Add columns or tables
|
||||
6
.changes/unreleased/Feature-20251029-152510.yaml
Normal file
6
.changes/unreleased/Feature-20251029-152510.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: Add columns for comments linked to an activity in the activity list export
|
||||
time: 2025-10-29T15:25:10.493968528+01:00
|
||||
custom:
|
||||
Issue: "404"
|
||||
SchemaChange: No schema change
|
||||
@@ -1,6 +0,0 @@
|
||||
kind: Feature
|
||||
body: Make a calendar item on the 'mes rendez-vous' page clickable. Clicking will navigate to the edit page of the calendar item.
|
||||
time: 2025-11-12T10:32:24.916576945+01:00
|
||||
custom:
|
||||
Issue: "461"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Fixed-20251029-124355.yaml
Normal file
6
.changes/unreleased/Fixed-20251029-124355.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: 'Fix: display also social actions linked to parents of the selected social issue'
|
||||
time: 2025-10-29T12:43:55.008647232+01:00
|
||||
custom:
|
||||
Issue: "451"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Fixed-20251029-143836.yaml
Normal file
6
.changes/unreleased/Fixed-20251029-143836.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: 'Fix: export actions and their results in csv even when action does not have any goals attached to it.'
|
||||
time: 2025-10-29T14:38:36.195220844+01:00
|
||||
custom:
|
||||
Issue: "453"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/Fixed-20251104-135108.yaml
Normal file
6
.changes/unreleased/Fixed-20251104-135108.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Fix the possibility to delete a workflow
|
||||
time: 2025-11-04T13:51:08.113234488+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: Drop or rename table or columns, or enforce new constraint that must be manually fixed
|
||||
6
.changes/unreleased/Fixed-20251106-161605.yaml
Normal file
6
.changes/unreleased/Fixed-20251106-161605.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Fix suggestion of referrer when creating notification for accompanyingPeriodWorkDocument
|
||||
time: 2025-11-06T16:16:05.861813041+01:00
|
||||
custom:
|
||||
Issue: "428"
|
||||
SchemaChange: No schema change
|
||||
@@ -1,6 +0,0 @@
|
||||
kind: Fixed
|
||||
body: Display calendar items for which an invite was accepted on the mes rendez-vous page
|
||||
time: 2025-11-12T17:00:25.58946528+01:00
|
||||
custom:
|
||||
Issue: "463"
|
||||
SchemaChange: No schema change
|
||||
@@ -1,7 +0,0 @@
|
||||
kind: Fixed
|
||||
body: |
|
||||
Improve accessibility on login page
|
||||
time: 2025-11-13T12:01:25.488478771+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/UX-20251006-123932.yaml
Normal file
6
.changes/unreleased/UX-20251006-123932.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: UX
|
||||
body: Change the terms 'cercle' and 'centre' to 'service', and 'territoire' respectively.
|
||||
time: 2025-10-06T12:39:32.514056818+02:00
|
||||
custom:
|
||||
Issue: "425"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/UX-20251029-110804.yaml
Normal file
6
.changes/unreleased/UX-20251029-110804.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: UX
|
||||
body: Improve the ux for selecting whether user wants to be notified of the final step of a workflow or all steps
|
||||
time: 2025-10-29T11:08:04.077020411+01:00
|
||||
custom:
|
||||
Issue: "542"
|
||||
SchemaChange: No schema change
|
||||
@@ -1,6 +0,0 @@
|
||||
kind: UX
|
||||
body: Remove the label if there is only one scope and no scope picking field is displayed.
|
||||
time: 2025-10-30T15:31:26.807444365+01:00
|
||||
custom:
|
||||
Issue: "449"
|
||||
SchemaChange: No schema change
|
||||
6
.changes/unreleased/UX-20251030-180919.yaml
Normal file
6
.changes/unreleased/UX-20251030-180919.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: UX
|
||||
body: Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr'
|
||||
time: 2025-10-30T18:09:19.373907522+01:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
||||
@@ -1,21 +0,0 @@
|
||||
## v4.7.0 - 2025-11-10
|
||||
### Feature
|
||||
* ([#385](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/385)) Create invitation list in user menu
|
||||
* ([#404](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/404)) Add columns for comments linked to an activity in the activity list export
|
||||
### Fixed
|
||||
* ([#451](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/451)) Fix: display also social actions linked to parents of the selected social issue
|
||||
* ([#453](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/453)) Fix: export actions and their results in csv even when action does not have any goals attached to it.
|
||||
* Fix the possibility to delete a workflow
|
||||
|
||||
**Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed
|
||||
* ([#457](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/457)) Fix the fusion of thirdparty properties that are located in another schema than public for TO_ONE relations + add extra loop for MANY_TO_MANY relations where thirdparty is the source instead of the target
|
||||
* ([#428](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/428)) Fix suggestion of referrer when creating notification for accompanyingPeriodWorkDocument
|
||||
### DX
|
||||
* Send notifications log to dedicated channel, if it exists
|
||||
|
||||
### UX
|
||||
* ([#425](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/425)) Change the terms 'cercle' and 'centre' to 'service', and 'territoire' respectively.
|
||||
* ([#542](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/542)) Improve the ux for selecting whether user wants to be notified of the final step of a workflow or all steps
|
||||
* Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr'
|
||||
* ([#455](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/455)) Change the order of display for results and objectives in the social work/action form
|
||||
* Wrap text when it is too long within badges
|
||||
@@ -19,11 +19,11 @@ max_line_length = 80
|
||||
[COMMIT_EDITMSG]
|
||||
max_line_length = 0
|
||||
|
||||
[*.{js, vue, ts}]
|
||||
[*.{js,vue,ts}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[.rst]
|
||||
ident_size = 3
|
||||
ident_style = space
|
||||
[*.rst]
|
||||
indent_size = 3
|
||||
indent_style = space
|
||||
|
||||
|
||||
@@ -234,17 +234,17 @@ This must be a decision made by a human, not by an AI. Every AI task must abort
|
||||
|
||||
#### Running Tests
|
||||
|
||||
The tests are run from the project's root (not from the bundle's root).
|
||||
The tests are run from the project's root (not from the bundle's root: so, do not change the directory to any bundle directory before running tests).
|
||||
|
||||
Tests must be run using the `symfony` command:
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
vendor/bin/phpunit
|
||||
|
||||
# Run a specific test file
|
||||
vendor/bin/phpunit path/to/TestFile.php
|
||||
symfony composer exec phpunit -- path/to/TestFile.php
|
||||
|
||||
# Run a specific test method
|
||||
vendor/bin/phpunit --filter methodName path/to/TestFile.php
|
||||
symfony composer exec phpunit -- --filter methodName path/to/TestFile.php
|
||||
```
|
||||
|
||||
When writing tests, only test specific files. Do not run all tests or the full
|
||||
|
||||
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": false
|
||||
}
|
||||
30
.vscode/launch.json
vendored
Normal file
30
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Chill Debug",
|
||||
"type": "php",
|
||||
"request": "launch",
|
||||
"port": 9000,
|
||||
"pathMappings": {
|
||||
"/var/www/html": "${workspaceFolder}"
|
||||
},
|
||||
"preLaunchTask": "symfony"
|
||||
},
|
||||
{
|
||||
"name": "Yarn Encore Dev (Watch)",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "yarn encore dev --watch",
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
],
|
||||
"compounds": [
|
||||
{
|
||||
"name": "Chill Debug + Yarn Encore Dev (Watch)",
|
||||
"configurations": ["Chill Debug", "Yarn Encore Dev (Watch)"]
|
||||
}
|
||||
]
|
||||
}
|
||||
23
.vscode/tasks.json
vendored
Normal file
23
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "symfony",
|
||||
"args": [
|
||||
"server:start",
|
||||
"--allow-http",
|
||||
"--no-tls",
|
||||
"--port=8000",
|
||||
"--allow-all-ip",
|
||||
"-d"
|
||||
],
|
||||
"label": "symfony"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"command": "yarn",
|
||||
"args": ["encore", "dev", "--watch"],
|
||||
"label": "webpack"
|
||||
}
|
||||
]
|
||||
}
|
||||
406
CHANGELOG.md
406
CHANGELOG.md
@@ -6,28 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v4.7.0 - 2025-11-10
|
||||
### Feature
|
||||
* ([#385](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/385)) Create invitation list in user menu
|
||||
* ([#404](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/404)) Add columns for comments linked to an activity in the activity list export
|
||||
### Fixed
|
||||
* ([#451](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/451)) Fix: display also social actions linked to parents of the selected social issue
|
||||
* ([#453](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/453)) Fix: export actions and their results in csv even when action does not have any goals attached to it.
|
||||
* Fix the possibility to delete a workflow
|
||||
|
||||
**Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed
|
||||
* ([#457](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/457)) Fix the fusion of thirdparty properties that are located in another schema than public for TO_ONE relations + add extra loop for MANY_TO_MANY relations where thirdparty is the source instead of the target
|
||||
* ([#428](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/428)) Fix suggestion of referrer when creating notification for accompanyingPeriodWorkDocument
|
||||
### DX
|
||||
* Send notifications log to dedicated channel, if it exists
|
||||
|
||||
### UX
|
||||
* ([#425](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/425)) Change the terms 'cercle' and 'centre' to 'service', and 'territoire' respectively.
|
||||
* ([#542](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/542)) Improve the ux for selecting whether user wants to be notified of the final step of a workflow or all steps
|
||||
* Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr'
|
||||
* ([#455](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/455)) Change the order of display for results and objectives in the social work/action form
|
||||
* Wrap text when it is too long within badges
|
||||
|
||||
## v4.6.1 - 2025-10-27
|
||||
### Fixed
|
||||
* Fix export case where no 'reason' is picked within the PersonHavingActivityBetweenDateFilter.php
|
||||
@@ -49,57 +27,57 @@ and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
## v4.5.1 - 2025-10-03
|
||||
### Fixed
|
||||
* Add missing javascript dependency
|
||||
* Add exception handling for conversion of attachment on sending external, when documens are already in pdf
|
||||
* Add missing javascript dependency
|
||||
* Add exception handling for conversion of attachment on sending external, when documens are already in pdf
|
||||
|
||||
## v4.5.0 - 2025-10-03
|
||||
### Feature
|
||||
* Only allow delete of attachment on workflows that are not final
|
||||
* Move up signature buttons on index workflow page for easier access
|
||||
* Filter out document from attachment list if it is the same as the workflow document
|
||||
* Block edition on attached document on workflow, if the workflow is finalized or sent external
|
||||
* Convert workflow's attached document to pdf while sending them external
|
||||
* After a signature is canceled or rejected, going to a waiting page until the post-process routines apply a workflow transition
|
||||
* Only allow delete of attachment on workflows that are not final
|
||||
* Move up signature buttons on index workflow page for easier access
|
||||
* Filter out document from attachment list if it is the same as the workflow document
|
||||
* Block edition on attached document on workflow, if the workflow is finalized or sent external
|
||||
* Convert workflow's attached document to pdf while sending them external
|
||||
* After a signature is canceled or rejected, going to a waiting page until the post-process routines apply a workflow transition
|
||||
### Fixed
|
||||
* ([#426](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/426)) Increased the number of required characters when setting a new password in Chill from 9 to 14 - GDPR compliance
|
||||
* Fix permissions on storedObject which are subject by a workflow
|
||||
* ([#426](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/426)) Increased the number of required characters when setting a new password in Chill from 9 to 14 - GDPR compliance
|
||||
* Fix permissions on storedObject which are subject by a workflow
|
||||
### DX
|
||||
* Introduce a WaitingScreen component to display a waiting screen
|
||||
* Introduce a WaitingScreen component to display a waiting screen
|
||||
|
||||
## v4.4.2 - 2025-09-12
|
||||
### Fixed
|
||||
* Fix document generation and workflow generation do not work on accompanying period work documents
|
||||
* Fix document generation and workflow generation do not work on accompanying period work documents
|
||||
|
||||
## v4.4.1 - 2025-09-11
|
||||
### Fixed
|
||||
* fix translations in duplicate evaluation document modal and realign close modal button
|
||||
* fix translations in duplicate evaluation document modal and realign close modal button
|
||||
|
||||
## v4.4.0 - 2025-09-11
|
||||
### Feature
|
||||
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Allow the merge of two accompanying period works
|
||||
* ([#369](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/369)) Duplication of a document to another accompanying period work evaluation
|
||||
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Fusion of two accompanying period works
|
||||
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Allow the merge of two accompanying period works
|
||||
* ([#369](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/369)) Duplication of a document to another accompanying period work evaluation
|
||||
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Fusion of two accompanying period works
|
||||
### Fixed
|
||||
* Fix display of 'duplicate' and 'merge' buttons in CRUD templates
|
||||
* Fix saving notification preferences in user's profile
|
||||
* Fix display of 'duplicate' and 'merge' buttons in CRUD templates
|
||||
* Fix saving notification preferences in user's profile
|
||||
|
||||
## v4.3.0 - 2025-09-08
|
||||
### Feature
|
||||
* ([#409](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/409)) Add 45 and 60 min calendar ranges
|
||||
* Add a command to generate a list of permissions
|
||||
* ([#412](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/412)) Add an absence end date
|
||||
* ([#409](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/409)) Add 45 and 60 min calendar ranges
|
||||
* Add a command to generate a list of permissions
|
||||
* ([#412](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/412)) Add an absence end date
|
||||
|
||||
**Schema Change**: Add columns or tables
|
||||
### Fixed
|
||||
* fix date formatting in calendar range display
|
||||
* Change route URL to avoid clash with person duplicate controller method
|
||||
* fix date formatting in calendar range display
|
||||
* Change route URL to avoid clash with person duplicate controller method
|
||||
|
||||
## v4.2.1 - 2025-09-03
|
||||
### Fixed
|
||||
* Fix exports to work with DirectExportInterface
|
||||
* Fix exports to work with DirectExportInterface
|
||||
### DX
|
||||
* Improve error message when a stored object cannot be written on local disk
|
||||
|
||||
|
||||
|
||||
## v4.2.0 - 2025-09-02
|
||||
### Feature
|
||||
@@ -114,26 +92,26 @@ and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
## v4.1.0 - 2025-08-26
|
||||
### Feature
|
||||
* ([#400](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/400)) Add filter to social actions list to filter out actions where current user intervenes
|
||||
* ([#399](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/399)) Show filters on list pages unfolded by default
|
||||
* Expansion of event module with new fields in the creation form: thematic, internal/external animator, responsable, and budget elements. Filtering options in the event list + adapted exports
|
||||
* ([#400](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/400)) Add filter to social actions list to filter out actions where current user intervenes
|
||||
* ([#399](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/399)) Show filters on list pages unfolded by default
|
||||
* Expansion of event module with new fields in the creation form: thematic, internal/external animator, responsable, and budget elements. Filtering options in the event list + adapted exports
|
||||
|
||||
**Schema Change**: Add columns or tables
|
||||
### Fixed
|
||||
* ([#382](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/382)) adjust display logic for accompanying period dates, include closing date if period is closed.
|
||||
* ([#384](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/384)) add min and step attributes to integer field in DateIntervalType
|
||||
* ([#382](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/382)) adjust display logic for accompanying period dates, include closing date if period is closed.
|
||||
* ([#384](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/384)) add min and step attributes to integer field in DateIntervalType
|
||||
### UX
|
||||
* Limit display of participations in event list
|
||||
* Limit display of participations in event list
|
||||
|
||||
## v4.0.2 - 2025-07-09
|
||||
### Fixed
|
||||
* Fix add missing translation
|
||||
* Fix the transfer of evaluations and documents during of accompanyingperiodwork
|
||||
* Fix add missing translation
|
||||
* Fix the transfer of evaluations and documents during of accompanyingperiodwork
|
||||
|
||||
## v4.0.1 - 2025-07-08
|
||||
### Fixed
|
||||
* Fix package.json for compilation
|
||||
|
||||
|
||||
|
||||
## v4.0.0 - 2025-07-08
|
||||
### Feature
|
||||
@@ -212,30 +190,30 @@ framework:
|
||||
|
||||
## v3.12.1 - 2025-06-30
|
||||
### Fixed
|
||||
* Fix loading of the list of documents
|
||||
* Fix loading of the list of documents
|
||||
|
||||
## v3.12.0 - 2025-06-30
|
||||
### Feature
|
||||
* ([#377](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/377)) Add the document file name to the document title when a user upload a document, unless there is already a document title.
|
||||
* Add desactivation date for social action and issue csv export
|
||||
* Add Emoji and Fullscreen feature to ckeditor configuration
|
||||
* ([#321](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/321)) Create editor which allow us to toggle between rich and simple text editor
|
||||
* Do not remove workflow which are automatically canceled after staling for more than 30 days
|
||||
* ([#377](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/377)) Add the document file name to the document title when a user upload a document, unless there is already a document title.
|
||||
* Add desactivation date for social action and issue csv export
|
||||
* Add Emoji and Fullscreen feature to ckeditor configuration
|
||||
* ([#321](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/321)) Create editor which allow us to toggle between rich and simple text editor
|
||||
* Do not remove workflow which are automatically canceled after staling for more than 30 days
|
||||
### Fixed
|
||||
* ([#376](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/376)) trying to prevent bug of typeerror in doc-history + improved display of document history
|
||||
* ([#381](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/381)) Display previous participation in acc course work even if the person has left the acc course
|
||||
* ([#372](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/372)) Fix display of text in calendar events
|
||||
* Add missing translation for user_group.no_user_groups
|
||||
* Fix admin entity edit actions for event admin entities and activity reason (category) entities
|
||||
* ([#376](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/376)) trying to prevent bug of typeerror in doc-history + improved display of document history
|
||||
* ([#381](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/381)) Display previous participation in acc course work even if the person has left the acc course
|
||||
* ([#372](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/372)) Fix display of text in calendar events
|
||||
* Add missing translation for user_group.no_user_groups
|
||||
* Fix admin entity edit actions for event admin entities and activity reason (category) entities
|
||||
* ([#392](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/392)) Allow null and cast as string to setContent method for NewsItem
|
||||
|
||||
* ([#393](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/393)) Doc Generation: the "dump only" method send the document as an email attachment.
|
||||
|
||||
* ([#393](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/393)) Doc Generation: the "dump only" method send the document as an email attachment.
|
||||
### DX
|
||||
* ([#352](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/352)) Remove dead code for wopi-link module
|
||||
* Replace library node-sass by sass, and upgrade bootstrap to version 5.3 (yarn upgrade / install is required)
|
||||
* ([#352](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/352)) Remove dead code for wopi-link module
|
||||
* Replace library node-sass by sass, and upgrade bootstrap to version 5.3 (yarn upgrade / install is required)
|
||||
### UX
|
||||
* ([#374](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/374)) Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page
|
||||
* Improve labeling of fields in person resource creation form
|
||||
* ([#374](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/374)) Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page
|
||||
* Improve labeling of fields in person resource creation form
|
||||
|
||||
## v3.11.0 - 2025-04-17
|
||||
### Feature
|
||||
@@ -259,11 +237,11 @@ framework:
|
||||
|
||||
## v3.10.3 - 2025-03-18
|
||||
### DX
|
||||
* Eslint fixes
|
||||
* Eslint fixes
|
||||
|
||||
## v3.10.2 - 2025-03-17
|
||||
### Fixed
|
||||
* Replace a ts-expect-error with a ts-ignore
|
||||
* Replace a ts-expect-error with a ts-ignore
|
||||
|
||||
## v3.10.1 - 2025-03-17
|
||||
### DX
|
||||
@@ -271,37 +249,37 @@ framework:
|
||||
|
||||
## v3.10.0 - 2025-03-17
|
||||
### Feature
|
||||
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
|
||||
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
|
||||
### Fixed
|
||||
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
|
||||
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups
|
||||
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
|
||||
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups
|
||||
|
||||
## v3.9.2 - 2025-02-27
|
||||
### Fixed
|
||||
* Use fetchResults method to fetch all social issues instead of only the first page
|
||||
* Use fetchResults method to fetch all social issues instead of only the first page
|
||||
|
||||
## v3.9.1 - 2025-02-27
|
||||
### Fixed
|
||||
* Fix post/patch request with missing 'type' property for gender
|
||||
* Fix post/patch request with missing 'type' property for gender
|
||||
|
||||
## v3.9.0 - 2025-02-27
|
||||
### Feature
|
||||
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
|
||||
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
|
||||
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
|
||||
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
|
||||
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
|
||||
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
|
||||
### Fixed
|
||||
* fix generation of document with accompanying period context, and list of activities and works
|
||||
* fix generation of document with accompanying period context, and list of activities and works
|
||||
### DX
|
||||
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations
|
||||
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations
|
||||
|
||||
## v3.8.2 - 2025-02-10
|
||||
### Fixed
|
||||
* ([#358](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/358)) Remove "filter" button on list of documents in the workflow's "add attachement" modal
|
||||
* ([#358](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/358)) Remove "filter" button on list of documents in the workflow's "add attachement" modal
|
||||
|
||||
## v3.8.1 - 2025-02-05
|
||||
### Fixed
|
||||
* Fix household link in the parcours banner
|
||||
* Fix household link in the parcours banner
|
||||
|
||||
## v3.8.0 - 2025-02-03
|
||||
### Feature
|
||||
@@ -317,7 +295,7 @@ framework:
|
||||
|
||||
## v3.7.1 - 2025-01-21
|
||||
### Fixed
|
||||
* Fix legacy configuration processor for notifier component
|
||||
* Fix legacy configuration processor for notifier component
|
||||
|
||||
## v3.7.0 - 2025-01-21
|
||||
### Feature
|
||||
@@ -384,33 +362,33 @@ chill_main:
|
||||
|
||||
## v3.6.0 - 2025-01-16
|
||||
### Feature
|
||||
* Importer for addresses does not fails when the postal code is not found with some addresses, and compute a recap list of all addresses that could not be imported. This recap list can be send by email.
|
||||
* Importer for addresses does not fails when the postal code is not found with some addresses, and compute a recap list of all addresses that could not be imported. This recap list can be send by email.
|
||||
* ([#346](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/346)) Create a driver for storing documents on disk (instead of openstack object store)
|
||||
|
||||
* Add address importer from french Base d'Adresse Nationale (BAN)
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add csv export for social issues and social actions
|
||||
|
||||
* Add address importer from french Base d'Adresse Nationale (BAN)
|
||||
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add csv export for social issues and social actions
|
||||
### Fixed
|
||||
* Export: fix missing alias in activity between certain dates filter. Condition added for alias.
|
||||
* Export: fix missing alias in activity between certain dates filter. Condition added for alias.
|
||||
|
||||
## v3.5.3 - 2025-01-07
|
||||
### Fixed
|
||||
* Fix the EntityToJsonTransformer to return an empty array if the value is ""
|
||||
* Fix the EntityToJsonTransformer to return an empty array if the value is ""
|
||||
|
||||
## v3.5.2 - 2024-12-19
|
||||
### Fixed
|
||||
* ([#345](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/345)) Export: activity filtering of users that were associated to an activity between certain dates. Results contained activities that were not within the specified date range"
|
||||
* ([#345](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/345)) Export: activity filtering of users that were associated to an activity between certain dates. Results contained activities that were not within the specified date range"
|
||||
|
||||
## v3.5.1 - 2024-12-16
|
||||
### Fixed
|
||||
* Filiation: fix the display of the gender label in the graph
|
||||
* Wrap handling of PdfSignedMessage into transactions
|
||||
* Filiation: fix the display of the gender label in the graph
|
||||
* Wrap handling of PdfSignedMessage into transactions
|
||||
|
||||
## v3.5.0 - 2024-12-09
|
||||
### Feature
|
||||
* ([#318](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/318)) Show all the pages of the documents in the signature app
|
||||
* ([#318](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/318)) Show all the pages of the documents in the signature app
|
||||
### Fixed
|
||||
* Wrap the signature's change state into a transaction, to avoid race conditions
|
||||
* Fix display of gender label
|
||||
* Wrap the signature's change state into a transaction, to avoid race conditions
|
||||
* Fix display of gender label
|
||||
|
||||
## v3.4.3 - 2024-12-05
|
||||
### Fixed
|
||||
@@ -419,76 +397,76 @@ chill_main:
|
||||
|
||||
## v3.4.2 - 2024-12-05
|
||||
### Fixed
|
||||
* ([#329](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/329)) Fix the serialization of gender for the generation of documents
|
||||
* ([#337](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/337)) Enforce unique contraint on activity storedobject
|
||||
* ([#329](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/329)) Fix the serialization of gender for the generation of documents
|
||||
* ([#337](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/337)) Enforce unique contraint on activity storedobject
|
||||
### DX
|
||||
* ([#310](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/310)) Clean migrations, to reduce the number of bloated migration when running diff on schema
|
||||
* ([#310](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/310)) Clean migrations, to reduce the number of bloated migration when running diff on schema
|
||||
|
||||
## v3.4.1 - 2024-11-22
|
||||
### Fixed
|
||||
* Set the workflow's title to notification content and subject
|
||||
* Set the workflow's title to notification content and subject
|
||||
|
||||
## v3.4.0 - 2024-11-20
|
||||
### Feature
|
||||
* ([#314](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/314)) Admin: improve document type admin form with a select field for related class.
|
||||
Admin: Allow administrator to assign multiple group centers in one go to a user.
|
||||
Admin: Allow administrator to assign multiple group centers in one go to a user.
|
||||
|
||||
## v3.3.0 - 2024-11-20
|
||||
### Feature
|
||||
* Electronic signature
|
||||
|
||||
Implementation of the electronic signature for documents within chill.
|
||||
* ([#286](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/286)) The behavoir of the voters for stored objects is adjusted so as to limit edit and delete possibilities to users related to the activity, social action or workflow entity.
|
||||
* ([#288](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/288)) Metadata form added for person signatures
|
||||
* Add a signature step in workflow, which allow to apply an electronic signature on documents
|
||||
* Keep an history of each version of a stored object.
|
||||
* Add a "send external" step in workflow, which allow to send stored objects and other elements to remote people, by sending them a public url
|
||||
Implementation of the electronic signature for documents within chill.
|
||||
* ([#286](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/286)) The behavoir of the voters for stored objects is adjusted so as to limit edit and delete possibilities to users related to the activity, social action or workflow entity.
|
||||
* ([#288](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/288)) Metadata form added for person signatures
|
||||
* Add a signature step in workflow, which allow to apply an electronic signature on documents
|
||||
* Keep an history of each version of a stored object.
|
||||
* Add a "send external" step in workflow, which allow to send stored objects and other elements to remote people, by sending them a public url
|
||||
### Fixed
|
||||
* Adjust household list export to include households even if their address is NULL
|
||||
* Remove validation of date string on deathDate
|
||||
* Adjust household list export to include households even if their address is NULL
|
||||
* Remove validation of date string on deathDate
|
||||
|
||||
## v3.2.4 - 2024-11-06
|
||||
### Fixed
|
||||
* Fix compilation of chill assets
|
||||
* Fix compilation of chill assets
|
||||
|
||||
## v3.2.3 - 2024-11-05
|
||||
### Fixed
|
||||
* ([#315](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/315)) Fix display of accompanying period work referrers. Only current referrers should be displayed.
|
||||
Fix color of Chill footer
|
||||
Fix color of Chill footer
|
||||
|
||||
## v3.2.2 - 2024-10-31
|
||||
### Fixed
|
||||
* Fix gender translation for unknown
|
||||
* Fix gender translation for unknown
|
||||
|
||||
## v3.2.1 - 2024-10-31
|
||||
### Fixed
|
||||
* Add the possibility of unknown to the gender entity
|
||||
* Fix the fusion of person doubles by excluding accompanyingPeriod work entities to be deleted. They are moved instead.
|
||||
* Add the possibility of unknown to the gender entity
|
||||
* Fix the fusion of person doubles by excluding accompanyingPeriod work entities to be deleted. They are moved instead.
|
||||
|
||||
## v3.2.0 - 2024-10-30
|
||||
### Feature
|
||||
* Introduce a gender entity
|
||||
* Introduce a gender entity
|
||||
|
||||
## v3.1.1 - 2024-10-01
|
||||
### Fixed
|
||||
* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf
|
||||
* ([#308](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/308)) Show only the current referrer in the page "show" for an accompanying period workf
|
||||
* ([#309](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/309)) Correctly compute the grouping by referrer aggregator
|
||||
|
||||
* Fixed typing of custom field long choice and custom field group
|
||||
|
||||
* Fixed typing of custom field long choice and custom field group
|
||||
|
||||
## v3.1.0 - 2024-08-30
|
||||
### Feature
|
||||
* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe.
|
||||
* Add export aggregator to aggregate activities by household + filter persons that are not part of an accompanyingperiod during a certain timeframe.
|
||||
|
||||
## v3.0.0 - 2024-08-26
|
||||
### Fixed
|
||||
* Fix delete action for accompanying periods in draft state
|
||||
* Fix connection to azure when making an calendar event in chill
|
||||
* CollectionType js fixes for remove button and adding multiple entries
|
||||
* Fix delete action for accompanying periods in draft state
|
||||
* Fix connection to azure when making an calendar event in chill
|
||||
* CollectionType js fixes for remove button and adding multiple entries
|
||||
|
||||
## v2.24.0 - 2024-09-11
|
||||
### Feature
|
||||
* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document.
|
||||
* ([#306](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/306)) When a document is converted or downloaded in the browser, this document is removed from the browser memory after 45s. Future click on the button re-download the document.
|
||||
|
||||
## v2.23.0 - 2024-07-23 & 2024-07-19
|
||||
### Feature
|
||||
@@ -523,13 +501,13 @@ Fix color of Chill footer
|
||||
|
||||
## v2.22.2 - 2024-07-03
|
||||
### Fixed
|
||||
* Remove scope required for event participation stats
|
||||
* Remove scope required for event participation stats
|
||||
|
||||
## v2.22.1 - 2024-07-01
|
||||
### Fixed
|
||||
* Remove debug word
|
||||
* Remove debug word
|
||||
### DX
|
||||
* Add a command for reading official address DB from Luxembourg and update chill addresses
|
||||
* Add a command for reading official address DB from Luxembourg and update chill addresses
|
||||
|
||||
## v2.22.0 - 2024-06-25
|
||||
### Feature
|
||||
@@ -572,7 +550,7 @@ Fix color of Chill footer
|
||||
|
||||
## v2.20.1 - 2024-06-05
|
||||
### Fixed
|
||||
* Do not allow StoredObjectCreated for edit and convert buttons
|
||||
* Do not allow StoredObjectCreated for edit and convert buttons
|
||||
|
||||
## v2.20.0 - 2024-06-05
|
||||
### Fixed
|
||||
@@ -619,96 +597,96 @@ Fix color of Chill footer
|
||||
|
||||
## v2.18.2 - 2024-04-12
|
||||
### Fixed
|
||||
* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record
|
||||
* ([#250](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/250)) Postal codes import : fix the source URL and the keys to handle each record
|
||||
|
||||
## v2.18.1 - 2024-03-26
|
||||
### Fixed
|
||||
* Fix layout issue in document generation for admin (minor)
|
||||
* Fix layout issue in document generation for admin (minor)
|
||||
|
||||
## v2.18.0 - 2024-03-26
|
||||
### Feature
|
||||
* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation
|
||||
* ([#268](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/268)) Improve admin UX to configure document templates for document generation
|
||||
### Fixed
|
||||
* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job
|
||||
* ([#267](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/267)) Fix the join between job and user in the user list (admin): show only the current user job
|
||||
|
||||
## v2.17.0 - 2024-03-19
|
||||
### Feature
|
||||
* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates
|
||||
* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course
|
||||
* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields
|
||||
* ([#237](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/237)) New export filter for social actions with an evaluation created between two dates
|
||||
* ([#258](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/258)) In the list of accompangying period, add the list of person's centers and the duration of the course
|
||||
* ([#238](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/238)) Allow to customize list person with new fields
|
||||
* ([#159](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/159)) Admin can publish news on the homepage
|
||||
### Fixed
|
||||
* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill
|
||||
* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period
|
||||
* ([#264](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/264)) Fix languages: load the languages in all availables languages configured for Chill
|
||||
* ([#259](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/259)) Keep a consistent behaviour between the filtering of activities within the document generation (model "accompanying period with activities"), and the same filter in the list of activities for an accompanying period
|
||||
|
||||
## v2.16.3 - 2024-02-26
|
||||
### Fixed
|
||||
* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier'
|
||||
* ([#236](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/236)) Fix translation of user job -> 'service' must be 'métier'
|
||||
### UX
|
||||
* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters
|
||||
* ([#232](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/232)) Order user jobs and services alphabetically in export filters
|
||||
|
||||
## v2.16.2 - 2024-02-21
|
||||
### Fixed
|
||||
* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template
|
||||
* Check for null values in closing motive of parcours d'accompagnement for correct rendering of template
|
||||
|
||||
## v2.16.1 - 2024-02-09
|
||||
### Fixed
|
||||
* Force bootstrap version to avoid error in builds with newer version
|
||||
* Force bootstrap version to avoid error in builds with newer version
|
||||
|
||||
## v2.16.0 - 2024-02-08
|
||||
### Feature
|
||||
* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span
|
||||
* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids
|
||||
* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this
|
||||
* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating
|
||||
* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address
|
||||
* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason
|
||||
* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work
|
||||
* Modernize the event bundle, with some new fields and multiple improvements
|
||||
* ([#231](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/231)) Create new filter for persons having a participation in an accompanying period during a certain time span
|
||||
* ([#241](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/241)) [Export][List of accompanyign period] Add two columns: the list of persons participating to the period, and their ids
|
||||
* ([#244](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/244)) Add capability to generate export about change of steps of accompanying period, and generate exports for this
|
||||
* ([#253](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/253)) Export: group accompanying period by person participating
|
||||
* ([#243](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/243)) Export: add filter for courses not linked to a reference address
|
||||
* ([#229](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/229)) Allow to group activities linked with accompanying period by reason
|
||||
* ([#115](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/115)) Prevent social work to be saved when another user edited conccurently the social work
|
||||
* Modernize the event bundle, with some new fields and multiple improvements
|
||||
### Fixed
|
||||
* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method
|
||||
* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form
|
||||
* ([#220](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/220)) Fix error in logs about wrong typing of eventArgs in onEditNotificationComment method
|
||||
* ([#256](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/256)) Fix the conditions upon which social actions should be optional or required in relation to social issues within the activity creation form
|
||||
### UX
|
||||
* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin.
|
||||
* ([#260](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/260)) Order list of centers alphabetically in dropdown 'user' section admin.
|
||||
|
||||
## v2.15.2 - 2024-01-11
|
||||
### Fixed
|
||||
* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files
|
||||
* Fix the id_seq used when creating a new accompanying period participation during fusion of two person files
|
||||
### DX
|
||||
* Set placeholder to False for expanded EntityType form fields where required is set to False.
|
||||
* Set placeholder to False for expanded EntityType form fields where required is set to False.
|
||||
|
||||
## v2.15.1 - 2023-12-20
|
||||
### Fixed
|
||||
* Fix the household export query to exclude accompanying periods that are in draft state.
|
||||
* Fix the household export query to exclude accompanying periods that are in draft state.
|
||||
### DX
|
||||
* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx
|
||||
* ([#167](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/167)) Fixed readthedocs compilation by updating readthedocs config file and requirements for Sphinx
|
||||
|
||||
## v2.15.0 - 2023-12-11
|
||||
### Feature
|
||||
* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange"
|
||||
* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type"
|
||||
* ([#191](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/191)) Add export "number of household associate with an exchange"
|
||||
* ([#235](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/235)) Export: add dates on the filter "filter course by activity type"
|
||||
### Fixed
|
||||
* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period.
|
||||
* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick)
|
||||
* ([#214](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/214)) Fix error when posting an empty comment on an accompanying period.
|
||||
* ([#233](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/233)) Fix "filter evaluation by evaluation type" (and add select2 to the list of evaluation types to pick)
|
||||
* ([#234](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/234)) Fix "filter aside activity by date"
|
||||
|
||||
* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1)
|
||||
* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them
|
||||
|
||||
* ([#228](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/228)) Fix export of activity for people created before the introduction of the createdAt column on person (during v1)
|
||||
* ([#246](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/246)) Do not show activities, evaluations and social work when associated to a confidential accompanying period, except for the users which are allowed to see them
|
||||
|
||||
## v2.14.1 - 2023-11-29
|
||||
### Fixed
|
||||
* Export: fix list person with custom fields
|
||||
* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin
|
||||
* Fix error in ListEvaluation when "handling agents" are alone
|
||||
* Export: fix list person with custom fields
|
||||
* ([#100](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/100)) Add a paginator to budget elements (resource and charge types) in the admin
|
||||
* Fix error in ListEvaluation when "handling agents" are alone
|
||||
|
||||
## v2.14.0 - 2023-11-24
|
||||
### Feature
|
||||
* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order
|
||||
* ([#161](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/161)) Export: in filter "Filter accompanying period work (social action) by type, goal and result", order the items alphabetically or with the defined order
|
||||
### Fixed
|
||||
* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export
|
||||
* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null
|
||||
* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields
|
||||
* Fix various errors in custom fields administration
|
||||
* ([#141](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/141)) Export: on filter "action by type goals, and results", restore the fields when editing a saved export
|
||||
* ([#219](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/219)) Export: fix the list of accompanying period work, when the "calc date" is null
|
||||
* ([#222](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/222)) Fix rendering of custom fields
|
||||
* Fix various errors in custom fields administration
|
||||
|
||||
## v2.13.0 - 2023-11-21
|
||||
### Feature
|
||||
@@ -722,7 +700,7 @@ Fix color of Chill footer
|
||||
|
||||
## v2.12.1 - 2023-11-16
|
||||
### Fixed
|
||||
* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result"
|
||||
* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result"
|
||||
|
||||
## v2.12.0 - 2023-11-15
|
||||
### Feature
|
||||
@@ -753,36 +731,36 @@ Fix color of Chill footer
|
||||
|
||||
## v2.11.0 - 2023-11-07
|
||||
### Feature
|
||||
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
||||
* ([#194](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/194)) Export: add a filter "filter activity by creator job"
|
||||
### Fixed
|
||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit
|
||||
* Fix "group activity by creator job" aggregator
|
||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix "group accompanying period by geographical unit": take into account the accompanying periods when the period is not located within an unit
|
||||
* Fix "group activity by creator job" aggregator
|
||||
|
||||
## v2.10.6 - 2023-11-07
|
||||
### Fixed
|
||||
* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement
|
||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies
|
||||
* ([#182](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/182)) Fix merging of double person files. Adjustement relationship sql statement
|
||||
* ([#185](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/185)) Export: fix aggregator by geographical unit on person: avoid inconsistencies
|
||||
|
||||
## v2.10.5 - 2023-11-05
|
||||
### Fixed
|
||||
* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type
|
||||
* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date"
|
||||
* ([#183](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/183)) Fix "problem during download" on some filters, which used a wrong data type
|
||||
* ([#184](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/184)) Fix filter "activity by date"
|
||||
|
||||
## v2.10.4 - 2023-10-26
|
||||
### Fixed
|
||||
* Fix null value constraint errors when merging relationships in doubles
|
||||
* Fix null value constraint errors when merging relationships in doubles
|
||||
|
||||
## v2.10.3 - 2023-10-26
|
||||
### Fixed
|
||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface
|
||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Replace old method of getting translator with injection of translatorInterface
|
||||
|
||||
## v2.10.2 - 2023-10-26
|
||||
### Fixed
|
||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get().
|
||||
* ([#175](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/175)) Use injection of translator instead of ->get().
|
||||
|
||||
## v2.10.1 - 2023-10-24
|
||||
### Fixed
|
||||
* Fix export controller when generating an export without any data in session
|
||||
* Fix export controller when generating an export without any data in session
|
||||
|
||||
## v2.10.0 - 2023-10-24
|
||||
### Feature
|
||||
@@ -802,16 +780,16 @@ Fix color of Chill footer
|
||||
- ajout d'un filtre et regroupement par usager participant sur les échanges
|
||||
- ajout d'un regroupement: par type d'activité associé au parcours;
|
||||
- trie les filtre et regroupements par ordre alphabétique dans els exports
|
||||
- ajout d'un paramètre qui permet de désactiver le filtre par centre dans les exports
|
||||
- ajout d'un paramètre qui permet de désactiver le filtre par territoire dans les exports
|
||||
- correction de l'interface de date dans les filtres et regroupements "par statut du parcours à la date"
|
||||
|
||||
## v2.9.2 - 2023-10-17
|
||||
### Fixed
|
||||
* Fix possible null values in string's entities
|
||||
* Fix possible null values in string's entities
|
||||
|
||||
## v2.9.1 - 2023-10-17
|
||||
### Fixed
|
||||
* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers
|
||||
* Fix the handling of activity form when editing or creating an activity in an accompanying period with multiple centers
|
||||
|
||||
## v2.9.0 - 2023-10-17
|
||||
### Feature
|
||||
@@ -859,57 +837,57 @@ But if you do not need this any more, you must ensure that the configuration key
|
||||
|
||||
## v2.7.0 - 2023-09-27
|
||||
### Feature
|
||||
* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string)
|
||||
* ([#155](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/155)) The regulation list load accompanying periods by exact postal code (address associated with postal code), and not by the content of the postal code (postal code with same code's string)
|
||||
### Fixed
|
||||
* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one
|
||||
* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities"
|
||||
* ([#142](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/142)) Fix the label of filter ActivityTypeFilter to a more obvious one
|
||||
* ([#140](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/140)) [export] Fix association of filter "filter location by type" which did not appears on "list of activities"
|
||||
|
||||
## v2.6.3 - 2023-09-19
|
||||
### Fixed
|
||||
* Remove id property from document
|
||||
mappedsuperclass
|
||||
* Remove id property from document
|
||||
mappedsuperclass
|
||||
|
||||
## v2.6.2 - 2023-09-18
|
||||
### Fixed
|
||||
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.
|
||||
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.
|
||||
|
||||
## v2.6.1 - 2023-09-14
|
||||
### Fixed
|
||||
* Filter out active centers in exports, which uses a different PickCenterType.
|
||||
* Filter out active centers in exports, which uses a different PickCenterType.
|
||||
|
||||
## v2.6.0 - 2023-09-14
|
||||
### Feature
|
||||
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations.
|
||||
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location
|
||||
* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use.
|
||||
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations.
|
||||
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location
|
||||
* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use.
|
||||
### Fixed
|
||||
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons
|
||||
* Missing translation in Work Actions exports
|
||||
* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this.
|
||||
* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an
|
||||
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons
|
||||
* Missing translation in Work Actions exports
|
||||
* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this.
|
||||
* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an
|
||||
error when trying to reedit a saved export
|
||||
|
||||
|
||||
* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member.
|
||||
|
||||
* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member.
|
||||
* Add missing translation for comment field placeholder in repositionning household editor.
|
||||
|
||||
* Do not send an email to creator twice when adding a comment to a notification
|
||||
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2
|
||||
|
||||
* Do not send an email to creator twice when adding a comment to a notification
|
||||
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2
|
||||
### UX
|
||||
* Uniformize badge-person in household banner (background, size)
|
||||
|
||||
|
||||
|
||||
## v2.5.3 - 2023-07-20
|
||||
### Fixed
|
||||
* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous.
|
||||
* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous.
|
||||
|
||||
## v2.5.2 - 2023-07-15
|
||||
### Fixed
|
||||
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
||||
* [Collate Address] when updating address point, do not use the point's address reference if the similarity is below the requirement for associating the address reference and the address (it uses the postcode's center instead)
|
||||
|
||||
## v2.5.1 - 2023-07-14
|
||||
### Fixed
|
||||
* [collate addresses] block collating addresses to another address reference where the address reference is already the best match
|
||||
* [collate addresses] block collating addresses to another address reference where the address reference is already the best match
|
||||
|
||||
## v2.5.0 - 2023-07-14
|
||||
### Feature
|
||||
@@ -982,7 +960,7 @@ error when trying to reedit a saved export
|
||||
- ajout d'un regroupement par métier des intervenants sur un parcours;
|
||||
- ajout d'un regroupement par service des intervenants sur un parcours;
|
||||
- ajout d'un regroupement par utilisateur intervenant sur un parcours
|
||||
- ajout d'un regroupement "par centre de l'usager";
|
||||
- ajout d'un regroupement "par territoire de l'usager";
|
||||
- ajout d'un filtre "par métier intervenant sur un parcours";
|
||||
- ajout d'un filtre "par service intervenant sur un parcours";
|
||||
- création d'un rôle spécifique pour voir les parcours confidentiels (et séparer de celui de la liste qui permet de ré-assigner les parcours en lot);
|
||||
|
||||
@@ -54,7 +54,7 @@ Arborescence:
|
||||
- person
|
||||
- personvendee
|
||||
- household_edit_metadata
|
||||
- index.js
|
||||
- index.ts
|
||||
```
|
||||
|
||||
## Organisation des feuilles de styles
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { trans, setLocale, setLocaleFallbacks } from "./ux-translator";
|
||||
import {
|
||||
trans,
|
||||
setLocale,
|
||||
getLocale,
|
||||
setLocaleFallbacks,
|
||||
} from "./ux-translator";
|
||||
|
||||
setLocaleFallbacks({"en": "fr", "nl": "fr", "fr": "en"});
|
||||
setLocale('fr');
|
||||
setLocaleFallbacks({ en: "fr", nl: "fr", fr: "en" });
|
||||
setLocale("fr");
|
||||
|
||||
export { trans };
|
||||
export * from '../var/translations';
|
||||
export { trans, getLocale };
|
||||
export * from "../var/translations";
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src",
|
||||
"Chill\\TicketBundle\\": "src/Bundle/ChillTicketBundle/src",
|
||||
"Chill\\Utils\\Rector\\": "utils/rector/src"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -34,6 +34,7 @@ return [
|
||||
Chill\ThirdPartyBundle\ChillThirdPartyBundle::class => ['all' => true],
|
||||
Chill\BudgetBundle\ChillBudgetBundle::class => ['all' => true],
|
||||
Chill\WopiBundle\ChillWopiBundle::class => ['all' => true],
|
||||
Chill\TicketBundle\ChillTicketBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
|
||||
loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
chill_main:
|
||||
available_languages: [ '%env(resolve:LOCALE)%', 'en', 'nl' ]
|
||||
available_languages: [ '%env(resolve:LOCALE)%', 'en' ]
|
||||
available_countries: ['BE', 'FR']
|
||||
top_banner:
|
||||
visible: false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
chill_doc_store:
|
||||
use_driver: openstack
|
||||
use_driver: local_storage
|
||||
local_storage:
|
||||
storage_path: '%kernel.project_dir%/var/storage'
|
||||
openstack:
|
||||
|
||||
5
config/packages/chill_ticket.yaml
Normal file
5
config/packages/chill_ticket.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
chill_ticket:
|
||||
ticket:
|
||||
person_per_ticket: one # One of "one"; "many"
|
||||
response_time_exceeded_delay: PT12H
|
||||
|
||||
@@ -14,6 +14,7 @@ doctrine_migrations:
|
||||
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
|
||||
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
|
||||
'Chill\Migrations\Report': '@ChillReportBundle/migrations'
|
||||
'Chill\Migrations\Ticket': '@ChillTicketBundle/migrations'
|
||||
all_or_nothing:
|
||||
true
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ framework:
|
||||
'Chill\MainBundle\Export\Messenger\ExportRequestGenerationMessage': priority
|
||||
'Chill\MainBundle\Export\Messenger\RemoveExportGenerationMessage': async
|
||||
'Chill\MainBundle\Notification\Email\NotificationEmailMessages\ScheduleDailyNotificationDigestMessage': async
|
||||
'Chill\TicketBundle\Messenger\PostTicketUpdateMessage': async
|
||||
# end of routes added by chill-bundles recipes
|
||||
# Route your messages to the transports
|
||||
# 'App\Message\YourMessage': async
|
||||
|
||||
2
config/routes/chill_ticket.yaml
Normal file
2
config/routes/chill_ticket.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
chill_ticket_bundle:
|
||||
resource: '@ChillTicketBundle/config/routes.yaml'
|
||||
@@ -1,16 +1,25 @@
|
||||
# Makefile for MkDocs documentation
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
MKDOCS = mkdocs
|
||||
BUILDDIR = site
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = build
|
||||
|
||||
# User-friendly check for mkdocs
|
||||
ifeq ($(shell which $(MKDOCS) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(MKDOCS)' command was not found. Make sure you have MkDocs installed with 'pip install mkdocs mkdocs-material', then make sure the mkdocs executable is in your PATH.)
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
.PHONY: help clean html serve build
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
|
||||
@@ -10,26 +10,20 @@ Compilation into HTML
|
||||
|
||||
To compile this documentation :
|
||||
|
||||
1. Install [MkDocs](https://www.mkdocs.org/) and MkDocs Material
|
||||
1. Install [sphinx-doc](http://sphinx-doc.org)
|
||||
``` bash
|
||||
$ virtualenv .venv # creation of the virtual env (only the first time)
|
||||
$ source .venv/bin/activate # activate the virtual env
|
||||
(.venv) $ pip install -r requirements.txt
|
||||
```
|
||||
2. Install submodules : $ git submodule update --init;
|
||||
3. run `make html` or `mkdocs build` from the root directory
|
||||
4. The base file is located on site/index.html
|
||||
3. run `make html` from the root directory
|
||||
4. The base file is located on build/html/index.html
|
||||
``` bash
|
||||
$ cd site
|
||||
$ cd build/html
|
||||
$ python -m http.server 8888 # will serve the site on the port 8888
|
||||
```
|
||||
|
||||
Alternatively, you can use the built-in development server:
|
||||
``` bash
|
||||
(.venv) $ mkdocs serve
|
||||
```
|
||||
This will start a development server at http://127.0.0.1:8000/ with live reload.
|
||||
|
||||
Contribute
|
||||
===========
|
||||
|
||||
|
||||
137
docs/mkdocs.yml
137
docs/mkdocs.yml
@@ -1,137 +0,0 @@
|
||||
site_name: Chill Documentation
|
||||
site_description: Documentation for Chill - A free software for social workers
|
||||
site_url: https://docs.chill.social
|
||||
repo_url: https://gitlab.com/Chill-project/chill-bundles
|
||||
repo_name: Chill-project/chill-bundles
|
||||
|
||||
docs_dir: source
|
||||
|
||||
copyright: Copyright © 2014-2024 Champs-Libres Cooperative SCRLFS - GNU Free Documentation License v1.3
|
||||
|
||||
theme:
|
||||
name: material
|
||||
language: en
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.tabs.sticky
|
||||
- navigation.sections
|
||||
- navigation.expand
|
||||
- navigation.path
|
||||
- navigation.top
|
||||
- search.highlight
|
||||
- search.share
|
||||
- search.suggest
|
||||
- toc.follow
|
||||
- content.code.copy
|
||||
- content.code.annotate
|
||||
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- scheme: default
|
||||
primary: blue
|
||||
accent: blue
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- scheme: slate
|
||||
primary: blue
|
||||
accent: blue
|
||||
toggle:
|
||||
icon: material/brightness-4
|
||||
name: Switch to light mode
|
||||
|
||||
font:
|
||||
text: Roboto
|
||||
code: Roboto Mono
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- autorefs
|
||||
|
||||
markdown_extensions:
|
||||
- admonition
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
- toc:
|
||||
permalink: true
|
||||
- tables
|
||||
- attr_list
|
||||
- md_in_html
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Installation:
|
||||
- installation/index.md
|
||||
- Development: installation/installation-development.md
|
||||
- Production: installation/installation-production.md
|
||||
- Document Storage: installation/document-storage.md
|
||||
- Load Addresses: installation/load-addresses.md
|
||||
- Production Setup: installation/prod.md
|
||||
- Calendar SMS: installation/prod-calendar-sms-sending.md
|
||||
- MS Graph Configuration: installation/msgraph-configure.md
|
||||
- Enable Collabora: installation/enable-collabora-for-dev.md
|
||||
- Development:
|
||||
- development/index.md
|
||||
- Access Control: development/access_control_model.md
|
||||
- API: development/api.md
|
||||
- Assets: development/assets.md
|
||||
- Code Quality: development/code-quality.md
|
||||
- Create Bundle: development/create-a-new-bundle.md
|
||||
- Cronjobs: development/cronjob.md
|
||||
- CRUD: development/crud.md
|
||||
- Database Principles: development/database-principles.md
|
||||
- Embeddable Comments: development/embeddable-comments.md
|
||||
- Entity Info: development/entity-info.md
|
||||
- ESLint: development/es-lint.md
|
||||
- Exports: development/exports.md
|
||||
- FAQ: development/FAQ.md
|
||||
- Forms: development/forms.md
|
||||
- Localisation: development/localisation.md
|
||||
- Logging: development/logging.md
|
||||
- Manual:
|
||||
- development/manual/index.md
|
||||
- Routing and Menus: development/manual/routing-and-menus.md
|
||||
- Menus: development/menus.md
|
||||
- Messages to Users: development/messages-to-users.md
|
||||
- Migrations: development/migrations.md
|
||||
- Pagination: development/pagination.md
|
||||
- Render Entity: development/render-entity.md
|
||||
- Routing: development/routing.md
|
||||
- Run Tests: development/run-tests.md
|
||||
- Searching: development/searching.md
|
||||
- Timelines: development/timelines.md
|
||||
- Useful Snippets: development/useful-snippets.md
|
||||
- User Interface:
|
||||
- CSS Classes: development/user-interface/css-classes.md
|
||||
- JS Functions: development/user-interface/js-functions.md
|
||||
- Layout Template: development/user-interface/layout-template-usage.md
|
||||
- Widgets: development/user-interface/widgets.md
|
||||
- Bundles:
|
||||
- bundles/index.md
|
||||
- Activity: bundles/activity.md
|
||||
- Custom Fields: bundles/custom-fields.md
|
||||
- Event: bundles/event.md
|
||||
- Group: bundles/group.md
|
||||
- LDAP: bundles/ldap.md
|
||||
- Main: bundles/main.md
|
||||
- Person: bundles/person.md
|
||||
- Report: bundles/report.md
|
||||
|
||||
extra:
|
||||
social:
|
||||
- icon: fontawesome/brands/gitlab
|
||||
link: https://gitlab.com/Chill-project
|
||||
- icon: fontawesome/solid/comments
|
||||
link: https://app.element.io/#/room/#chill-social-admin:matrix.org
|
||||
@@ -1,4 +1,7 @@
|
||||
mkdocs>=1.5.0
|
||||
mkdocs-material>=9.4.0
|
||||
pymdown-extensions>=10.3.0
|
||||
mkdocs-autorefs>=0.5.0
|
||||
docutils==0.13.1
|
||||
Pygments==2.2.0
|
||||
sphinx==1.8.5
|
||||
Jinja2<3.1
|
||||
git+https://github.com/fabpot/sphinx-php.git@v2.0.2#egg_name=sphinx-php
|
||||
jsx-lexer===0.0.8
|
||||
sphinx_rtd_theme==0.5.0
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
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".
|
||||
|
||||
# Activity bundle
|
||||
|
||||
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
|
||||
|
||||
:local:
|
||||
|
||||
###### Entities provided
|
||||
|
||||
Describe the entities provided.
|
||||
|
||||
###### Configuration options
|
||||
|
||||
Those options are available under `chill_activity` key.
|
||||
|
||||
Example of configuration:
|
||||
|
||||
chill_activity:
|
||||
form:
|
||||
time_duration:
|
||||
- { label: '12 minutes', seconds: 720 }
|
||||
- { label: '30 minutes', seconds: 1800 }
|
||||
|
||||
form.time_duration *array*
|
||||
The duration which might be suggested when the user create or update an activity. The value must be an array of object, where each object must have a `label` and a `seconds` key. The label provide which is shown to user (the label will be translated, if possible) and the seconds the duration.
|
||||
|
||||
Example: see the example above
|
||||
|
||||
Default value: the values available are 5, 10, 15, 20, 25, 30, 45 minutes, and 1 hour, 1 hour 15, 1 hour 30, 1 hour 45 and 2 hours.
|
||||
|
||||
###### Macros
|
||||
|
||||
## Activity reason sticker
|
||||
|
||||
Macro file
|
||||
`ChillActivityBundle:ActivityReason:macro.html.twig`
|
||||
Macro envelope
|
||||
`reason(r)`
|
||||
|
||||
`p` is an instance of :class:`Chill\ActivityBundle\Entity\ActivityReason`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an activity reason.
|
||||
Example usage :
|
||||
```jinja
|
||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||
|
||||
{{ m.reason(r) }}
|
||||
```
|
||||
@@ -35,12 +35,12 @@ Example of configuration:
|
||||
|
||||
chill_activity:
|
||||
form:
|
||||
time_duration:
|
||||
time_duration:
|
||||
- { label: '12 minutes', seconds: 720 }
|
||||
- { label: '30 minutes', seconds: 1800 }
|
||||
|
||||
form.time_duration *array*
|
||||
The duration which might be suggested when the user create or update an activity. The value must be an array of object, where each object must have a `label` and a `seconds` key. The label provide which is shown to user (the label will be translated, if possible) and the seconds the duration.
|
||||
The duration which might be suggested when the user create or update an activity. The value must be an array of object, where each object must have a :code:`label` and a :code:`seconds` key. The label provide which is shown to user (the label will be translated, if possible) and the seconds the duration.
|
||||
|
||||
Example: see the example above
|
||||
|
||||
@@ -57,9 +57,9 @@ Activity reason sticker
|
||||
Macro file
|
||||
`ChillActivityBundle:ActivityReason:macro.html.twig`
|
||||
Macro envelope
|
||||
`reason(r)`
|
||||
:code:`reason(r)`
|
||||
|
||||
`p` is an instance of :class:`Chill\ActivityBundle\Entity\ActivityReason`
|
||||
:code:`p` is an instance of :class:`Chill\ActivityBundle\Entity\ActivityReason`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an activity reason.
|
||||
@@ -1,381 +0,0 @@
|
||||
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".
|
||||
|
||||
|
||||
## Custom fields bundle
|
||||
|
||||
This bundle provides the ability to add custom fields to existing entities.
|
||||
|
||||
Those custom fields contains extra data and will be stored in the DB, along with other data's entities. It may be string, text, date, ... or a link to an existing entities.
|
||||
|
||||
In the database, custom fields are stored in json format.
|
||||
|
||||
The full specification discussed [here. ](https://redmine.champs-libres.coop/issues/239)
|
||||
|
||||
[JSON Type on postgresql documentation ](http://www.postgresql.org/docs/9.3/static/datatype-json.html)
|
||||
The documentation of json type, which is used to store data in the database.
|
||||
|
||||
|
||||
:depth: 4
|
||||
:local:
|
||||
|
||||
### Custom Fields concepts
|
||||
|
||||
Custom fields are extra data which may be added to entities by user. If a developer implements custom fields on a entity, users will be able to add more fields on this entity.
|
||||
|
||||
Example: the [person bundle` allows to record `firstname`, `lastname`, `date of birth` fields. But users need to store information about the kind of house he has (if he owns his house, if he rents it, ...). Custom fields allows to create those fields.
|
||||
|
||||
Automatically, those fields are added at the person form. They are also printed in the person view and in exports.
|
||||
|
||||
##### Custom fields and custom fields group
|
||||
|
||||
Custom fields are associated to a custom fields group. When a user want to add custom fields on an entity, he must first create a custom fields group and associate this field with an entity. Then he may add add custom fields to this groups.
|
||||
|
||||
Some entities needs a **default** custom fields group. For instance, the default custom fields group will be printed on the main form for person, and will be appended on the main person view. Some bundle does not use this feature (i.e. the `report` bundle).
|
||||
|
||||
In the future of the `person bundle`, other custom fields group will be added in forms accessible from the menu, allowing users to completely customize and separate their entities.
|
||||
|
||||
### Allow custom fields on an entity
|
||||
|
||||
As a developer, you must allow your users to add custom fields on your entities.
|
||||
|
||||
For having custom fields, the class of the entity must contain a variable for storing the custom data. **By convention this variable must be called $cFData**
|
||||
|
||||
##### Create a json field on your entity
|
||||
|
||||
Declare a json field in your database :
|
||||
|
||||
Chill\CustomFieldsBundle\Entity\BlopEntity:
|
||||
type: entity
|
||||
# ...
|
||||
fields:
|
||||
cFData:
|
||||
type: json_array
|
||||
|
||||
Create the field accordingly in the class logic :
|
||||
|
||||
namespace Chill\CustomFieldsBundle\Entity;
|
||||
|
||||
/**
|
||||
* BlopEntity
|
||||
*/
|
||||
class BlopEntity
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $cFData;
|
||||
|
||||
/**
|
||||
* You must set a setter in order to save automatically custom
|
||||
* fields from forms, using Form Component
|
||||
*
|
||||
* @param array $cFData
|
||||
* @return BlopEntity
|
||||
*/
|
||||
public function setCFData(array $cFData)
|
||||
{
|
||||
$this->cFData = $cFData;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* You also must create a getter in order to let Form
|
||||
* component populate form fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCFData()
|
||||
{
|
||||
return $this->cFData;
|
||||
}
|
||||
|
||||
##### Declare your customizable entity in configuration
|
||||
|
||||
This step is necessary to allow user to create custom fields group associated with this entity.
|
||||
|
||||
Two methods are available.
|
||||
|
||||
The recommended method is to do it in DependencyInjection/Extension class. It is recommended as your bundle will be well set up (for custom field) in every chill installation that use it.
|
||||
|
||||
The discouraged method is to declare via the app/config.yml file. This is very quick to set up for a given chill installation but it is not done automatically : in every chill installation that use your bundle, this step has to be performed.
|
||||
|
||||
In app/config.yml file (discouraged)
|
||||
""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This method is discouraged but explained first as it helps to undersand the recommended method.
|
||||
|
||||
Add those file under `chill_custom_fields` section :
|
||||
|
||||
chill_custom_fields:
|
||||
customizables_entities:
|
||||
- { class: Chill\YourBundleBundle\Entity\BlopEntity, name: blop_entity }
|
||||
|
||||
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
|
||||
* The class, which is a full FQDN class path
|
||||
|
||||
Automatically, in DependencyInjection/Extension class (recommended)
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
This is the recommended way for declaring customizable classes.
|
||||
|
||||
You can prepend configuration of `custom fields bundle` from the class `YourBundle\DependencyInjection\YourBundleExtension`. **Note** that you also have to implements `Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface` on this class to make the `prepend` function being taken into account.
|
||||
|
||||
Example here :
|
||||
|
||||
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
|
||||
'name' => 'blop_entity',)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
* The `name` allow you to define a string which is translatable. This string will appears when chill's admin will add/retrieve new customFieldsGroup.
|
||||
* The class, which is a full FQDN class path
|
||||
|
||||
`How to simplify configuration of multiple bundles ](http://symfony.com/doc/current/cookbook/bundles/prepend_extension.html)
|
||||
A cookbook page about prepending configuration.
|
||||
|
||||
##### Adding options to your custom fields groups
|
||||
|
||||
You may add options to the groups associated with an entity.
|
||||
|
||||
In `config.yml` the declaration should be :
|
||||
|
||||
chill_custom_fields:
|
||||
customizables_entities:
|
||||
-
|
||||
class: Chill\YourBundleBundle\Entity\BlopEntity
|
||||
name: BlopEntity
|
||||
options:
|
||||
# this will create a "myFieldKey" field as text, with a maxlength attribute to 150 (see http://symfony.com/doc/master/reference/forms/types/text.html)
|
||||
myFieldKey: {form_type: text, form_options: {attr: [maxlength: 150]}}
|
||||
|
||||
In the `PrependExtensionInterface::prepend` function, the options key will be added in the configuration definition :
|
||||
|
||||
class ChillYourBundleExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\YourBundleBundle\Entity\BlopEntity',
|
||||
'name' => 'BlopEntity',
|
||||
'options' => array(
|
||||
'myFieldKey' => [ 'form_type' => 'text', 'form_options' => [ 'attr' => [ 'maxlength' => 150 ] ]
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
**Example :** the entity `Report` from **ReportBundle** has to pick some custom fields belonging to a group to print them in *summaries* the timeline page. The definition will use the special type `custom_fields_group_linked_custom_field` which will add a select input with all fields associated with the current custom fields group :
|
||||
|
||||
class ChillReportExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
###### *
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$bundles = $container->getParameter('kernel.bundles');
|
||||
if (!isset($bundles['ChillCustomFieldsBundle'])) {
|
||||
throw new MissingBundleException('ChillCustomFieldsBundle');
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array(
|
||||
'class' => 'Chill\ReportBundle\Entity\Report',
|
||||
'name' => 'ReportEntity',
|
||||
'options' => array(
|
||||
'summary_fields' => array(
|
||||
'form_type' => 'custom_fields_group_linked_custom_fields',
|
||||
'form_options' =>
|
||||
[
|
||||
'multiple' => true,
|
||||
'expanded' => false
|
||||
]
|
||||
)
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Note that `custom_fields_group_linked_custom_fields` does not create any input on `CustomFieldsGroup` creation : there aren't any fields associated with the custom fields just after the group creation... You have to add custom fields and associate them with the newly created group to see them appears.
|
||||
|
||||
### Rendering custom fields and custom fields group in a template
|
||||
|
||||
Each custom field can be `active` or not. Only `active` custom fields has to be dislayed.
|
||||
|
||||
For rendering custom fields, two function are available :
|
||||
|
||||
* `chill_custom_field_widget` to render the widget. This function is defined on a customFieldType basis.
|
||||
* `chill_custom_field_label` to render the label. You can customize the label rendering by choosing the layout you would like to use.
|
||||
* `chill_custom_field_is_empty` indicates if the content of the custom fields is empty (return a boolean)
|
||||
|
||||
For rendering custom fields group, a function is available :
|
||||
|
||||
* `chill_custom_fields_group_widget` to render the widget. It will display the custom fields of the group in a dd / dt structure.
|
||||
|
||||
##### chill_custom_field_label
|
||||
|
||||
The signature is :
|
||||
|
||||
* `CustomField` **$customField** a customField instance
|
||||
* `array` **params** the parameters for rendering. Currently, 'label_layout' allow to choose a different label. Default is 'ChillCustomFieldsBundle:CustomField:render_label.html.twig'
|
||||
|
||||
Examples
|
||||
|
||||
{{ chill_custom_field_label(customField) }}
|
||||
|
||||
##### chill_custom_field_widget
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomField **$customField** a customField instance
|
||||
* string **$documentType** the type of document. Default to `html`.
|
||||
|
||||
Examples:
|
||||
|
||||
{{ chill_custom_field_widget(entity.customFields, customField) }}
|
||||
|
||||
##### chill_custom_field_is_empty
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomField **$customField** a customField instance
|
||||
|
||||
Examples :
|
||||
|
||||
{%- if chill_custom_field_is_empty(cFData, customField) == false -%}
|
||||
|
||||
##### chill_custom_fields_group_widget
|
||||
|
||||
This function only display custom fields that are `active`.
|
||||
|
||||
The signature is :
|
||||
|
||||
* array **$fields** the array raw, as stored in the db
|
||||
* CustomFieldsGroup **$customFieldsGroup** the custom field group to render
|
||||
|
||||
{{ chill_custom_fields_group_widget(entity.cFData, entity.customFieldsGroup) }}
|
||||
|
||||
### Custom Fields's form
|
||||
|
||||
You should simply use the 'custom_field' type in a template, with the group you would like to render in the `group` option's type.
|
||||
|
||||
Example :
|
||||
|
||||
namespace Chill\ReportBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class ReportType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$entityManager = $options['em'];
|
||||
|
||||
$builder
|
||||
->add('user')
|
||||
->add('date', 'date',
|
||||
array('required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
#add the custom fields :
|
||||
->add('cFData', 'custom_field',
|
||||
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\ReportBundle\Entity\Report'
|
||||
));
|
||||
|
||||
$resolver->setRequired(array(
|
||||
'em',
|
||||
'cFGroup',
|
||||
));
|
||||
|
||||
$resolver->setAllowedTypes(array(
|
||||
'em' => 'Doctrine\Common\Persistence\ObjectManager',
|
||||
'cFGroup' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'chill_reportbundle_report';
|
||||
}
|
||||
}
|
||||
|
||||
### Available configuration
|
||||
|
||||
Those options are available in the configuration, under the `chill_custom_field` key.
|
||||
|
||||
Example :
|
||||
|
||||
chill_custom_field:
|
||||
show_empty_values_in_views: false
|
||||
|
||||
show_empty_values_in_views *boolean*:
|
||||
Allow to hide / show empty values in views. The aim of this configuration parameter is to hide (or show) empty values when :term:`custom fields group` are rendered.
|
||||
|
||||
Default value : `true`
|
||||
|
||||
### Glossary
|
||||
|
||||
custom fields group
|
||||
A group of custom fields
|
||||
@@ -1,23 +0,0 @@
|
||||
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".
|
||||
|
||||
# Event bundle
|
||||
|
||||
## Template & Menu
|
||||
|
||||
The event bundle has a special template with a specific menu for actions on
|
||||
events. This menu is called `event`.
|
||||
|
||||
### ChillEventBundle::layout.html.twig
|
||||
|
||||
This layout extends `ChillMainBundle::layoutWithVerticalMenu.html.twig` and add the menu `event`
|
||||
|
||||
It proposes a new block :
|
||||
|
||||
* event_content
|
||||
|
||||
* where to display content relative to the event.
|
||||
@@ -1,34 +0,0 @@
|
||||
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".
|
||||
|
||||
# Group bundle
|
||||
|
||||
Allow to group people in a group. This group may be a family, an activity group, ...
|
||||
|
||||
:local:
|
||||
|
||||
###### Entities
|
||||
|
||||
###### Macros
|
||||
|
||||
## Group sticker
|
||||
|
||||
Macro file
|
||||
`ChillGroupBundle:Group:macro.html.twig`
|
||||
Macro name
|
||||
`_render`
|
||||
Macro envelope
|
||||
`group`, instance of :class:`Chill\GroupBundle\Entity\CGroup`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent group.
|
||||
Example usage :
|
||||
```jinja
|
||||
{% import 'ChillGroupBundle:Group:macro.html.twig' as m %}
|
||||
|
||||
{{ m._render(g) }}
|
||||
```
|
||||
@@ -33,9 +33,9 @@ Group sticker
|
||||
Macro file
|
||||
`ChillGroupBundle:Group:macro.html.twig`
|
||||
Macro name
|
||||
`_render`
|
||||
:code:`_render`
|
||||
Macro envelope
|
||||
`group`, instance of :class:`Chill\GroupBundle\Entity\CGroup`
|
||||
:code:`group`, instance of :class:`Chill\GroupBundle\Entity\CGroup`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent group.
|
||||
@@ -1,23 +0,0 @@
|
||||
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".
|
||||
|
||||
# Bundles documentation
|
||||
|
||||
You will find here documentation about bundles working with Chill.
|
||||
|
||||
- [Main bundle](main.md)
|
||||
- [Custom Fields bundle](custom-fields.md)
|
||||
- [Person bundle](person.md)
|
||||
- [Report bundle](report.md)
|
||||
- [Activity bundle](activity.md)
|
||||
- [Group bundle](group.md)
|
||||
- [Event bundle](event.md)
|
||||
- [Ldap bundle (synchronisation between ldap and database)](ldap.md)
|
||||
|
||||
### Your bundle here ?
|
||||
|
||||
The contributors still do not have a policy about those bundle integration, but we would like to be very open on this subject. Please write to us [or open an issue ](https://redmine.champs-libres.coop/projects/chill/issues).
|
||||
@@ -1,159 +0,0 @@
|
||||
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".
|
||||
|
||||
# LDAP bundle
|
||||
|
||||
This bundle binds the database with an ldap directory.
|
||||
|
||||
The bundle synchronize the ldap directory with users in the database. It also
|
||||
provides a way to check user credentials against the ldap directory.
|
||||
|
||||
:local:
|
||||
|
||||
###### Current limitations
|
||||
|
||||
- The length of the ldap dn must be < 255 characters
|
||||
- if the username extracted from the ldap is updated, the changes are not reflected in the database and remains the same
|
||||
|
||||
###### Entities provided
|
||||
|
||||
This bundle provides only one entity : :class:[Chill\\LdapBundle\\Entity\\UserLdapBinding`
|
||||
|
||||
###### How the synchronizer works ?
|
||||
|
||||
#. The synchronizer performs a query on `dn` and `query` defined in the [configuration ](configuration.md).
|
||||
#. For each entry returned by the query, it looks if the `dn` exists in the database
|
||||
|
||||
#. If the entry does not exists :
|
||||
|
||||
#. the synchronizer looks for user with same username as defined by `username_attr`, and bind it with the `dn` if it exists.
|
||||
#. else, a user is created with username defined by `username_attr` (if the ldap contains more than one attribute, the first attribute returned is used)
|
||||
|
||||
#. if a user exists which is already binded with the `dn`, the entry is ignored.
|
||||
|
||||
#. The synchronizer looks for dn existing in database and which were not returned by the query performed in 1.
|
||||
|
||||
#. If they exists, those user are set to `enabled=false`: they are not allowed to login.
|
||||
|
||||
###### Installation
|
||||
|
||||
This bundle requires :
|
||||
|
||||
- PHP LDAP ext
|
||||
- `symfony/ldap` with minimal version 3.1. Note that, currently, Chill uses Symfony 2.8: you should add the dependency on this single package manually
|
||||
|
||||
In your composer.json, for stable version :
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "~1.0"
|
||||
}
|
||||
|
||||
And for dev version :
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "dev-master@dev"
|
||||
}
|
||||
|
||||
###### Configuration
|
||||
|
||||
## Configuration of the bundle
|
||||
|
||||
# Default configuration for extension with alias: "chill_ldap"
|
||||
chill_ldap:
|
||||
server: # Required
|
||||
|
||||
# the host of the ldap directory
|
||||
host: ~ # Required, Example: localhost
|
||||
|
||||
# the port to reach the ldap directory
|
||||
port: 389
|
||||
|
||||
# the version of the ldap directory
|
||||
version: 3
|
||||
|
||||
# Is the use of ssl required to establish connection
|
||||
use_ssl: false
|
||||
|
||||
# Is the use of startssl required to establish connection
|
||||
use_starttls: false
|
||||
|
||||
# the user to bind to dn directory. Required for searching existing users.
|
||||
bind_dn: ~ # Required, Example: cn=user,dn=chill,dn=social
|
||||
|
||||
# the user's password to bind to dn directory.
|
||||
bind_password: ~ # Required, Example: paSSw0rD
|
||||
user_query: # Required
|
||||
|
||||
# The DN where the query is executed
|
||||
dn: ~ # Example: ou=People,dc=champs-libres,dc=coop
|
||||
|
||||
# The query which will allow to retrieve users
|
||||
query: ~ # Example: (&(objectClass=inetOrgPerson)(userPassword=*))
|
||||
|
||||
# The attribute which will provide username (=login)
|
||||
username_attr: cn
|
||||
|
||||
Example :
|
||||
|
||||
chill_ldap:
|
||||
server:
|
||||
# host, bind_dn and bind_password are imported from parameters.yml
|
||||
host: "%ldap_host%"
|
||||
bind_dn: "%ldap_bind_dn%"
|
||||
bind_password: "%ldap_bind_password%"
|
||||
user_query:
|
||||
dn: dc=champs-libres,dc=coop
|
||||
query: "(&(objectClass=inetOrgPerson)(userPassword=*))"
|
||||
|
||||
## Configuration of the security part of chill
|
||||
|
||||
Simply add the following config in the firewall of the security bundle :
|
||||
`chill_ldap_form_login: ~`. This config is located in `app/config/security.yml`
|
||||
|
||||
Example of a configuration :
|
||||
|
||||
# in app/config/security.yml
|
||||
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
|
||||
default:
|
||||
anonymous: ~
|
||||
# enable the login check by a form, agaisnt the database
|
||||
form_login:
|
||||
csrf_parameter: _csrf_token
|
||||
csrf_token_id: authenticate
|
||||
csrf_provider: form.csrf_provider
|
||||
# enable the login check by a form, against the ldap
|
||||
chill_ldap_form_login: ~ # this is the line you should add
|
||||
|
||||
Note that, if you enable the login check by form **and** by the ldap,
|
||||
the password will be checked against the database **and** against the ldap.
|
||||
If one of them match, the login will succeed.
|
||||
|
||||
If you want to completely disable login check against the database,
|
||||
simply remove the `form_login` entry and all his options.
|
||||
|
||||
## Command and crontab
|
||||
|
||||
Synchronize the database :
|
||||
|
||||
php app/console chill:ldap:synchronize
|
||||
|
||||
For getting more debug message :
|
||||
|
||||
php app/console chill:ldap:synchronize -vvv
|
||||
|
||||
You should run this command regularly (using crontab or
|
||||
`systemd timer ](https://www.freedesktop.org/software/systemd/man/systemd.timer.html#))
|
||||
to synchronize ldap and database automatically.
|
||||
@@ -35,34 +35,34 @@ This bundle provides only one entity : :class:`Chill\\LdapBundle\\Entity\\UserLd
|
||||
How the synchronizer works ?
|
||||
****************************
|
||||
|
||||
#. The synchronizer performs a query on `dn` and `query` defined in the :ref:`configuration <configuration>`.
|
||||
#. For each entry returned by the query, it looks if the `dn` exists in the database
|
||||
#. The synchronizer performs a query on :code:`dn` and :code:`query` defined in the :ref:`configuration <configuration>`.
|
||||
#. For each entry returned by the query, it looks if the :code:`dn` exists in the database
|
||||
|
||||
#. If the entry does not exists :
|
||||
|
||||
#. the synchronizer looks for user with same username as defined by `username_attr`, and bind it with the `dn` if it exists.
|
||||
#. else, a user is created with username defined by `username_attr` (if the ldap contains more than one attribute, the first attribute returned is used)
|
||||
#. the synchronizer looks for user with same username as defined by :code:`username_attr`, and bind it with the :code:`dn` if it exists.
|
||||
#. else, a user is created with username defined by :code:`username_attr` (if the ldap contains more than one attribute, the first attribute returned is used)
|
||||
|
||||
#. if a user exists which is already binded with the `dn`, the entry is ignored.
|
||||
#. if a user exists which is already binded with the :code:`dn`, the entry is ignored.
|
||||
|
||||
#. The synchronizer looks for dn existing in database and which were not returned by the query performed in 1.
|
||||
#. The synchronizer looks for dn existing in database and which were not returned by the query performed in 1.
|
||||
|
||||
#. If they exists, those user are set to `enabled=false`: they are not allowed to login.
|
||||
#. If they exists, those user are set to :code:`enabled=false`: they are not allowed to login.
|
||||
|
||||
Installation
|
||||
************
|
||||
|
||||
This bundle requires :
|
||||
This bundle requires :
|
||||
|
||||
- PHP LDAP ext
|
||||
- `symfony/ldap` with minimal version 3.1. Note that, currently, Chill uses Symfony 2.8: you should add the dependency on this single package manually
|
||||
- :code:`symfony/ldap` with minimal version 3.1. Note that, currently, Chill uses Symfony 2.8: you should add the dependency on this single package manually
|
||||
|
||||
In your composer.json, for stable version :
|
||||
In your composer.json, for stable version :
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "~1.0"
|
||||
}
|
||||
@@ -74,7 +74,7 @@ And for dev version :
|
||||
.. code-block:: json
|
||||
|
||||
"require": {
|
||||
// .. other dependencies
|
||||
// .. other dependencies
|
||||
"symfony/ldap" : "~3.1",
|
||||
"chill-project/ldap": "dev-master@dev"
|
||||
}
|
||||
@@ -126,7 +126,7 @@ Configuration of the bundle
|
||||
username_attr: cn
|
||||
|
||||
|
||||
Example :
|
||||
Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@@ -147,7 +147,7 @@ Configuration of the security part of chill
|
||||
Simply add the following config in the firewall of the security bundle :
|
||||
`chill_ldap_form_login: ~`. This config is located in `app/config/security.yml`
|
||||
|
||||
Example of a configuration :
|
||||
Example of a configuration :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@@ -169,26 +169,26 @@ Example of a configuration :
|
||||
chill_ldap_form_login: ~ # this is the line you should add
|
||||
|
||||
|
||||
Note that, if you enable the login check by form **and** by the ldap,
|
||||
Note that, if you enable the login check by form **and** by the ldap,
|
||||
the password will be checked against the database **and** against the ldap.
|
||||
If one of them match, the login will succeed.
|
||||
|
||||
If you want to completely disable login check against the database,
|
||||
simply remove the `form_login` entry and all his options.
|
||||
If you want to completely disable login check against the database,
|
||||
simply remove the :code:`form_login` entry and all his options.
|
||||
|
||||
.. _command-and-crontab:
|
||||
|
||||
Command and crontab
|
||||
===================
|
||||
|
||||
Synchronize the database :
|
||||
Synchronize the database :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console chill:ldap:synchronize
|
||||
|
||||
|
||||
For getting more debug message :
|
||||
For getting more debug message :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -196,7 +196,7 @@ For getting more debug message :
|
||||
|
||||
|
||||
|
||||
You should run this command regularly (using crontab or
|
||||
You should run this command regularly (using crontab or
|
||||
`systemd timer <https://www.freedesktop.org/software/systemd/man/systemd.timer.html#>`_)
|
||||
to synchronize ldap and database automatically.
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
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".
|
||||
|
||||
|
||||
# Main bundle
|
||||
|
||||
This bundle is **required** for running Chill.
|
||||
|
||||
This bundle provide :
|
||||
|
||||
* Access control model (users, groups, and all concepts)
|
||||
* ...
|
||||
|
||||
this section is incomplete.
|
||||
|
||||
###### Macros
|
||||
|
||||
## Address sticker
|
||||
|
||||
Macro file
|
||||
`ChillMainBundle:Address:macro.html.twig`
|
||||
Macro name
|
||||
`_render`
|
||||
Macro envelope
|
||||
`address`, instance of :class:`Chill\MainBundle\Entity\Address`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an address.
|
||||
Example usage :
|
||||
```jinja
|
||||
{% import 'ChillMainBundle:Address:macro.html.twig' as m %}
|
||||
|
||||
{{ m._render(address) }}
|
||||
```
|
||||
@@ -7,7 +7,7 @@
|
||||
Free Documentation License".
|
||||
|
||||
.. _main-bundle:
|
||||
|
||||
|
||||
Main bundle
|
||||
###########
|
||||
|
||||
@@ -34,9 +34,9 @@ Address sticker
|
||||
Macro file
|
||||
`ChillMainBundle:Address:macro.html.twig`
|
||||
Macro name
|
||||
`_render`
|
||||
:code:`_render`
|
||||
Macro envelope
|
||||
`address`, instance of :class:`Chill\MainBundle\Entity\Address`
|
||||
:code:`address`, instance of :class:`Chill\MainBundle\Entity\Address`
|
||||
|
||||
When to use this macro ?
|
||||
When you want to represent an address.
|
||||
@@ -1,196 +0,0 @@
|
||||
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".
|
||||
|
||||
# Person bundle
|
||||
|
||||
This bundle provides the ability to record people in the software. This bundle is required by other bundle.
|
||||
|
||||
:local:
|
||||
|
||||
###### Entities provided
|
||||
|
||||
describe entities provided by person bundle
|
||||
|
||||
|
||||
###### Search terms
|
||||
|
||||
The class [Chill\PersonBundle\Search\PersonSearch` provide the search module.
|
||||
|
||||
## Domain
|
||||
|
||||
The search upon "person" is provided by default. The `@person` domain search may be omitted.
|
||||
|
||||
* `@person` is the domain search for people.
|
||||
|
||||
## Arguments
|
||||
|
||||
* `firstname` : provide the search on firstname. Example : `firstname:Depardieu`. May match part of the firstname (`firsname:dep` will match Depardieu)
|
||||
* `lastname` : provide the search on lastname. May match part of the lastname.
|
||||
* `birthdate` : provide the search on the birthdate. Example : `birthdate:1996-01-19`
|
||||
* `gender`: performs search on man/woman. The accepted values are `man` or `woman`.
|
||||
* `nationality` : performs search on nationality. Value must be a country code `as described in ISO 3166 ](http://www.iso.org/iso/fr/home/standards/country_codes.htm). Example : [nationality:FR`.
|
||||
|
||||
## Default
|
||||
|
||||
The default search is performed on firstname and/or lastname. Both are concatened before search. If values are separated by spaces, the clause `AND` is used : the search `dep ge` will match 'Gérard Depardieu` or 'Jean Depagelles', but not 'Charline Depardieu' (missing 'Ge' in word).
|
||||
|
||||
###### Configuration options
|
||||
|
||||
Those options are available under `chill_person` key.
|
||||
|
||||
Example of configuration:
|
||||
|
||||
chill_person:
|
||||
validation:
|
||||
birthdate_not_after: P15Y
|
||||
person_fields:
|
||||
# note: visible is the default config. This key may be omitted if visible is chosen.
|
||||
nationality: hidden
|
||||
email: hidden
|
||||
place_of_birth: visible
|
||||
phonenumber: hidden
|
||||
country_of_birth: hidden
|
||||
marital_status: visible
|
||||
spoken_languages: hidden
|
||||
address: visible
|
||||
|
||||
birthdate_not_after *string*
|
||||
The period duration before today during which encoding birthdate is not possible. The period is a string matching the format of `ISO_8601`, which is also use to build `DateInterval classes ](http://php.net/manual/en/dateinterval.construct.php).
|
||||
|
||||
Example: [P1D`, `P18Y`
|
||||
|
||||
Default value: `P1D` which means that birthdate before the current day (= yesterday) are allowed.
|
||||
|
||||
person_fields *array*
|
||||
This define the visibility of some fields. By default, all fields are visible, but you can choose to hide some of them. Available keys are :
|
||||
|
||||
* `nationality`
|
||||
* `country_of_birth`
|
||||
* `place_of_birth`
|
||||
* `phonenumber`
|
||||
* `email`
|
||||
* `marital_status`
|
||||
* `spoken_languages`
|
||||
* `address`
|
||||
|
||||
Possibles values: `hidden` or `visible` (all other value will raise an Exception).
|
||||
|
||||
Default value : `visible`, which means that all fields are visible.
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
chill_person:
|
||||
person_fields:
|
||||
nationality: hidden
|
||||
email: hidden
|
||||
phonenumber: hidden
|
||||
```
|
||||
|
||||
If all the field of a "box" are hidden, the whole box does not appears. Example: if the fields `phonenumber` and `email` are hidden, the title `Contact information` will be hidden in the UI.
|
||||
|
||||
If you hide multiple fields, for a better integration you may want to override the template, for a better appeareance. See `the symfony documentation ](http://symfony.com/doc/current/book/templating.html#overriding-bundle-templates) about this feature.
|
||||
|
||||
###### Macros
|
||||
|
||||
## Sticker for a person
|
||||
|
||||
Macro file
|
||||
`ChillPersonBundle:Person:macro.html.twig`
|
||||
Macro envelope
|
||||
`render(p, withLink=false)`
|
||||
|
||||
`p` is an instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
`withLink` :class:`boolean`
|
||||
When to use this macro ?
|
||||
When you want to represent a person.
|
||||
Example usage :
|
||||
```jinja
|
||||
{% import "ChillPersonBundle:Person:macro.html.twig" as person_ %}
|
||||
|
||||
{{ person_.render(person, true) }}
|
||||
```
|
||||
|
||||
###### Layout events and delegated blocks
|
||||
|
||||
## `chill_block.person_post_vertical_menu` event
|
||||
|
||||
This event is available to add content below of the vertical menu (on the right).
|
||||
|
||||
The context is :
|
||||
|
||||
- `person` : the current person which is rendered. Instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
###### Widgets
|
||||
|
||||
## Add a list of person on homepage
|
||||
|
||||
The bundle provide a way to add a list of accompanyied person on the homepage:
|
||||
|
||||
chill_main:
|
||||
widgets:
|
||||
homepage:
|
||||
-
|
||||
order: 10
|
||||
widget_alias: person_list
|
||||
person_list:
|
||||
# customize the number of items
|
||||
number_of_items: 20
|
||||
|
||||
# only active
|
||||
only_active: true
|
||||
|
||||
# you can add some filtering class, which will implements
|
||||
# Chill\PersonBundle\PersonListWidget\PersonFilteringInterface
|
||||
filtering_class: "\Hepc\HomepagePersonFiltering"
|
||||
|
||||
# when the view is overriden, you can add some custom fields
|
||||
# to the view
|
||||
custom_fields: [school-2fb5440e-192c-11e6-b2fd-74d02b0c9b55]
|
||||
|
||||
###### Commands
|
||||
|
||||
## `chill:person:move`
|
||||
|
||||
Usage:
|
||||
chill:person:move [options]
|
||||
|
||||
Options:
|
||||
-f, --from=FROM The person id to delete, all associated data will be moved before
|
||||
-t, --to=TO The person id which will received data
|
||||
--dump-sql dump sql to stdout
|
||||
--force execute sql instead of dumping it
|
||||
-h, --help Display this help message
|
||||
-q, --quiet Do not output any message
|
||||
-V, --version Display this application version
|
||||
--ansi Force ANSI output
|
||||
--no-ansi Disable ANSI output
|
||||
-n, --no-interaction Do not ask any interactive question
|
||||
-e, --env=ENV The Environment name. [default: "dev"]
|
||||
--no-debug Switches off debug mode.
|
||||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
|
||||
Help:
|
||||
Move all the associated entities on a "from" person to a "to" person and remove the old person
|
||||
|
||||
Move all the entities associated to a person onto another one, and remove the old person.
|
||||
|
||||
Some entities are ignored and will be deleted:
|
||||
|
||||
- the accompanying periods ;
|
||||
- the data attached to a person entity: name, address, date of birth, etc. Thos should be merge before the move.
|
||||
|
||||
It is advised to run first the command with the `dump-sql` option and, then, use the `force` option.
|
||||
|
||||
The moving and suppression is executed inside a transaction, ensuring no data loss if the migration fails.
|
||||
|
||||
Using bash and awk, it is easy to use a TSV file (values separated by a tab, not a comma) to create move commands. Assuming our file is named `twins.tsv` and contains two columns: the first one with `from` ids, and the second one with `to` ids:
|
||||
|
||||
```bash
|
||||
awk '{ print "php app/console chill:person:move --dump-sql --from " $1 " --to " $2;}' twins.tsv
|
||||
```
|
||||
@@ -22,8 +22,8 @@ Entities provided
|
||||
.. todo::
|
||||
|
||||
describe entities provided by person bundle
|
||||
|
||||
|
||||
|
||||
|
||||
Search terms
|
||||
************
|
||||
|
||||
@@ -82,8 +82,8 @@ birthdate_not_after *string*
|
||||
Default value: `P1D` which means that birthdate before the current day (= yesterday) are allowed.
|
||||
|
||||
person_fields *array*
|
||||
This define the visibility of some fields. By default, all fields are visible, but you can choose to hide some of them. Available keys are :
|
||||
|
||||
This define the visibility of some fields. By default, all fields are visible, but you can choose to hide some of them. Available keys are :
|
||||
|
||||
* `nationality`
|
||||
* `country_of_birth`
|
||||
* `place_of_birth`
|
||||
@@ -97,7 +97,7 @@ person_fields *array*
|
||||
|
||||
Default value : `visible`, which means that all fields are visible.
|
||||
|
||||
Example:
|
||||
Example:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
@@ -107,10 +107,10 @@ person_fields *array*
|
||||
email: hidden
|
||||
phonenumber: hidden
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
If all the field of a "box" are hidden, the whole box does not appears. Example: if the fields `phonenumber` and `email` are hidden, the title `Contact information` will be hidden in the UI.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
If you hide multiple fields, for a better integration you may want to override the template, for a better appeareance. See `the symfony documentation <http://symfony.com/doc/current/book/templating.html#overriding-bundle-templates>`_ about this feature.
|
||||
|
||||
.. _person-bundle-macros:
|
||||
@@ -124,11 +124,11 @@ Sticker for a person
|
||||
Macro file
|
||||
`ChillPersonBundle:Person:macro.html.twig`
|
||||
Macro envelope
|
||||
`render(p, withLink=false)`
|
||||
:code:`render(p, withLink=false)`
|
||||
|
||||
`p` is an instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
:code:`p` is an instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
`withLink` :class:`boolean`
|
||||
:code:`withLink` :class:`boolean`
|
||||
When to use this macro ?
|
||||
When you want to represent a person.
|
||||
Example usage :
|
||||
@@ -141,14 +141,14 @@ Example usage :
|
||||
Layout events and delegated blocks
|
||||
***********************************
|
||||
|
||||
`chill_block.person_post_vertical_menu` event
|
||||
:code:`chill_block.person_post_vertical_menu` event
|
||||
====================================================
|
||||
|
||||
This event is available to add content below of the vertical menu (on the right).
|
||||
|
||||
The context is :
|
||||
The context is :
|
||||
|
||||
- `person` : the current person which is rendered. Instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
- :code:`person` : the current person which is rendered. Instance of :class:`Chill\PersonBundle\Entity\Person`
|
||||
|
||||
Widgets
|
||||
*******
|
||||
@@ -162,8 +162,8 @@ The bundle provide a way to add a list of accompanyied person on the homepage:
|
||||
|
||||
chill_main:
|
||||
widgets:
|
||||
homepage:
|
||||
-
|
||||
homepage:
|
||||
-
|
||||
order: 10
|
||||
widget_alias: person_list
|
||||
person_list:
|
||||
@@ -180,12 +180,12 @@ The bundle provide a way to add a list of accompanyied person on the homepage:
|
||||
# when the view is overriden, you can add some custom fields
|
||||
# to the view
|
||||
custom_fields: [school-2fb5440e-192c-11e6-b2fd-74d02b0c9b55]
|
||||
|
||||
|
||||
Commands
|
||||
********
|
||||
|
||||
|
||||
`chill:person:move`
|
||||
:code:`chill:person:move`
|
||||
=========================
|
||||
|
||||
.. code-block:: txt
|
||||
@@ -213,21 +213,21 @@ Commands
|
||||
|
||||
Move all the entities associated to a person onto another one, and remove the old person.
|
||||
|
||||
.. warning::
|
||||
.. warning::
|
||||
|
||||
Some entities are ignored and will be deleted:
|
||||
Some entities are ignored and will be deleted:
|
||||
|
||||
- the accompanying periods ;
|
||||
- the data attached to a person entity: name, address, date of birth, etc. Thos should be merge before the move.
|
||||
|
||||
It is advised to run first the command with the `dump-sql` option and, then, use the `force` option.
|
||||
It is advised to run first the command with the :code:`dump-sql` option and, then, use the :code:`force` option.
|
||||
|
||||
The moving and suppression is executed inside a transaction, ensuring no data loss if the migration fails.
|
||||
|
||||
.. note::
|
||||
|
||||
Using bash and awk, it is easy to use a TSV file (values separated by a tab, not a comma) to create move commands. Assuming our file is named `twins.tsv` and contains two columns: the first one with `from` ids, and the second one with `to` ids:
|
||||
Using bash and awk, it is easy to use a TSV file (values separated by a tab, not a comma) to create move commands. Assuming our file is named :code:`twins.tsv` and contains two columns: the first one with :code:`from` ids, and the second one with :code:`to` ids:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
awk '{ print "php app/console chill:person:move --dump-sql --from " $1 " --to " $2;}' twins.tsv
|
||||
awk '{ print "php app/console chill:person:move --dump-sql --from " $1 " --to " $2;}' twins.tsv
|
||||
@@ -1,32 +0,0 @@
|
||||
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".
|
||||
|
||||
# Report bundle
|
||||
|
||||
This bundle provides the ability to record report about people. We use custom fields to let user add fields to reports.
|
||||
|
||||
:local:
|
||||
|
||||
The documentation about report is not writtend
|
||||
|
||||
## Concepts
|
||||
|
||||
## Search
|
||||
|
||||
### Domain
|
||||
|
||||
* `@report` is the domain search for reports.
|
||||
|
||||
### Arguments
|
||||
|
||||
* `date` : The date of the report
|
||||
|
||||
### Default
|
||||
|
||||
The report's date is the default value.
|
||||
|
||||
An error is thrown if an argument `date` and a default is used.
|
||||
@@ -1,23 +0,0 @@
|
||||
# Frequently asked questions
|
||||
|
||||
## Continuous integration
|
||||
|
||||
Pipeline fails, but php-cs-fixer doesn't alert me when running it locally?
|
||||
========================================
|
||||
|
||||
It is possible that you run php-cs-fixer on your local instance of chill and no fixes are made.
|
||||
Everything seems fine, so you push. However, once the pipeline is run in gitlab, you're notified that it failed due to php
|
||||
cs errors.
|
||||
|
||||
In this case it's likely that you have to update your version of php-cs-fixer.
|
||||
php-cs-fixer is installed when building the docker image: https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic/src/branch/main/Dockerfile#L50
|
||||
|
||||
Consequently, to update php-cs-fixer, we have to update the image by building it again.
|
||||
|
||||
For this the following commands can be used.
|
||||
|
||||
```
|
||||
docker compose build --pull php
|
||||
# replace existing containers
|
||||
docker compose up -d --force-recreate php
|
||||
```
|
||||
36
docs/source/development/FAQ.rst
Normal file
36
docs/source/development/FAQ.rst
Normal file
@@ -0,0 +1,36 @@
|
||||
.. 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".
|
||||
|
||||
.. _faq:
|
||||
|
||||
|
||||
Frequently asked questions
|
||||
####################
|
||||
|
||||
Continuous integration
|
||||
***********
|
||||
|
||||
Pipeline fails, but php-cs-fixer doesn't alert me when running it locally ?
|
||||
========================================
|
||||
|
||||
It is possible that you run php-cs-fixer on your local instance of chill and no fixes are made.
|
||||
Everything seems fine, so you push. However once the pipeline is run in gitlab, you're notified that it failed due to php
|
||||
cs errors.
|
||||
|
||||
In this case it's likely that you have to update your version of php-cs-fixer.
|
||||
php-cs-fixer is installed when building the docker image: https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic/src/branch/main/Dockerfile#L50
|
||||
|
||||
Consequently, to update php-cs-fixer we have to update the image by building it again.
|
||||
|
||||
For this the following commands can be used,
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
docker compose build --pull php
|
||||
# replace existing containers
|
||||
docker compose up -d --force-recreate php
|
||||
@@ -1,15 +1,19 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
.. Copyright (C) 2015 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".
|
||||
|
||||
###### Access controle model
|
||||
Access controle model
|
||||
**********************
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
## Concepts
|
||||
Concepts
|
||||
========
|
||||
|
||||
Every time an entity is created, viewed or updated, the software check if the user has the permission to make this action. The decision is made with three parameters :
|
||||
|
||||
@@ -19,15 +23,20 @@ Every time an entity is created, viewed or updated, the software check if the us
|
||||
|
||||
The user must be granted access to the action on this particular entity, with this scope and center.
|
||||
|
||||
## TL;DR
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
### Resolve scope and center
|
||||
Resolve scope and center
|
||||
------------------------
|
||||
|
||||
In a service, resolve the center and scope of an entity
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||
|
||||
|
||||
class MyService {
|
||||
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||
@@ -49,6 +58,8 @@ In a service, resolve the center and scope of an entity
|
||||
|
||||
In twig template, resolve the center:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# resolve a center #}
|
||||
|
||||
{% if person|chill_resolve_center is not null%}
|
||||
@@ -70,6 +81,8 @@ In twig template, resolve the center:
|
||||
|
||||
In twig template, resolve the scope:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% if entity|chill_is_scope_concerned %}
|
||||
|
||||
{% if entity|chill_resolve_scope is iterable %}
|
||||
@@ -85,7 +98,10 @@ In twig template, resolve the scope:
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
### Build a ``Voter``
|
||||
Build a ``Voter``
|
||||
-----------------
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
@@ -135,6 +151,7 @@ In twig template, resolve the scope:
|
||||
->build();
|
||||
}
|
||||
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return $this->voterHelper->supports($attribute, $subject);
|
||||
@@ -177,19 +194,25 @@ In twig template, resolve the scope:
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
{
|
||||
return ['PersonDocument' => $this->getRoles() ];
|
||||
}
|
||||
}
|
||||
|
||||
## From an user point of view
|
||||
|
||||
|
||||
|
||||
From an user point of view
|
||||
==========================
|
||||
|
||||
The software is design to allow fine tuned access rights for complicated installation and team structure. The administrators may also decide that every user has the right to see all resources, where team have a more simple structure.
|
||||
|
||||
Here is an overview of the model.
|
||||
|
||||
### Chill can be multi-center
|
||||
Chill can be multi-center
|
||||
-------------------------
|
||||
|
||||
Chill is designed to be installed once for social center who work with multiple teams separated, or for social services's federation who would like to share the same installation of the software for all their members.
|
||||
|
||||
@@ -199,7 +222,8 @@ Otherwise, it is not required to create multiple center: Chill can also work for
|
||||
|
||||
Obviously, users working in the different centers are not allowed to see the entities (_persons_, _reports_, _activities_) of other centers. But users may be attached to multiple centers: consequently they will be able to see the entities of the multiple centers they are attached to.
|
||||
|
||||
### Inside center, scope divide team
|
||||
Inside center, scope divide team
|
||||
--------------------------------
|
||||
|
||||
Users are attached to one or more center and, inside to those center, there may exists differents scopes. The aim of those _scopes_ is to divide the whole team of social worker amongst different departement, for instance: the social team, the psychologist team, the nurse team, the administrative team, ... Each team is granted of different rights amongst scope. For instance, the social team may not see the _activities_ of the psychologist team. The administrative team may see the date & time's activities, but is not allowed to see the detail of those entities (the personal notes, ...).
|
||||
|
||||
@@ -209,7 +233,9 @@ As entities have only one scopes, if some entities must be shared across two dif
|
||||
|
||||
Example: if some activities must be seen and updated between nurses and psychologists, the administrator will create a scope "nurse and psy" and add the ability for both team "nurse" and "psychologist" to "create", "see", and "update" the activities belonging to scope "nurse and psy".
|
||||
|
||||
## Where does the [`scope`` and ``center`` comes from ?
|
||||
|
||||
Where does the ``scope`` and ``center`` comes from ?
|
||||
====================================================
|
||||
|
||||
Most often, scope and center comes from user's input:
|
||||
|
||||
@@ -230,23 +256,30 @@ But sometimes, this implementation does not fits the needs:
|
||||
|
||||
For this reasons, associated center and scopes must be resolved programmatically. The default implementation rely on the model association, as described above. But it becomes possible to change the behaviour on different implementations.
|
||||
|
||||
### Is my entity "concerned" by scopes ?
|
||||
Is my entity "concerned" by scopes ?
|
||||
------------------------------------
|
||||
|
||||
Some entities are concerned by scope, some not.
|
||||
|
||||
This is also programmatically resolved.
|
||||
|
||||
## The concepts translated into code
|
||||
The concepts translated into code
|
||||
===================================
|
||||
|
||||
.. figure:: /_static/access_control_model.png
|
||||
|
||||
Schema of the access control model
|
||||
|
||||
Chill handle **entities**, like *persons*, *reports* (associated to *persons*), *activities* (also associated to *_persons*), ... On creation, those entities are linked to one center and, eventually, to one scope. They implements the interface `HasCenterInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Somes entities are linked to a center through the entity they are associated with. For instance, *activities* or *reports* are associated to a *person*, and the person is associated to a *center*. The *report*'s *center* is always the *person*'s *center*.
|
||||
|
||||
Entities may be associated with a scope. In this case, they implement the `HasScopeInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Currently, only the *person* entity is not associated with a scope.
|
||||
|
||||
At each step of his lifetime (creation, view of the entity and eventually of his details, update and, eventually, deletion), the right of the user are checked. To decide wether the user is granted right to execute the action, the software must decide with those elements :
|
||||
@@ -258,10 +291,13 @@ At each step of his lifetime (creation, view of the entity and eventually of his
|
||||
|
||||
All those action are executed through symfony voters and helpers.
|
||||
|
||||
## How to check authorization ?
|
||||
How to check authorization ?
|
||||
============================
|
||||
|
||||
Just use the symfony way-of-doing, but do not forget to associate the entity you want to check access. For instance, in controller :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
class MyController extends Controller
|
||||
{
|
||||
|
||||
@@ -275,9 +311,12 @@ Just use the symfony way-of-doing, but do not forget to associate the entity you
|
||||
|
||||
And in template :
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ if is_granted('CHILL_ENTITY_SEE', entity) %}print something{% endif %}
|
||||
|
||||
### Retrieving reachable scopes and centers for a user
|
||||
Retrieving reachable scopes and centers for a user
|
||||
--------------------------------------------------
|
||||
|
||||
The class :class:`Chill\\MainBundle\\Security\\Authorization\\AuthorizationHelperInterface` helps you to get centers and scope reachable by a user.
|
||||
|
||||
@@ -286,7 +325,9 @@ Those methods are intentionnaly build to give information about user rights:
|
||||
- getReachableCenters: to get reachable centers for a user
|
||||
- getReachableScopes : to get reachable scopes for a user
|
||||
|
||||
### Adding your own roles
|
||||
|
||||
Adding your own roles
|
||||
---------------------
|
||||
|
||||
Extending Chill will requires you to define your own roles and rules for your entities. You will have to define your own voter to do so.
|
||||
|
||||
@@ -295,20 +336,28 @@ To create your own roles, you should:
|
||||
* implement your own voter. This voter will have to extends the :class:`Chill\\MainBundle\\Security\\AbstractChillVoter`. As defined by Symfony, this voter must be declared as a service and tagged with `security.voter`;
|
||||
* declare the role through implementing a service tagged with `chill.role` and implementing :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
|
||||
|
||||
.. note::
|
||||
|
||||
Both operation may be done through a simple class: you can implements :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface` and :class:`Chill\\MainBundle\\Security\\AbstractChillVoter` on the same class. See live example: :class:`Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter`, and similar examples in the `PersonBundle` and `ReportBundle`.
|
||||
|
||||
`How to Use Voters to Check User Permissions ](http://symfony.com/doc/current/cookbook/security/voters_data_permission.html)
|
||||
.. seealso::
|
||||
|
||||
`How to Use Voters to Check User Permissions <http://symfony.com/doc/current/cookbook/security/voters_data_permission.html>`_
|
||||
|
||||
From the symfony cookbook
|
||||
|
||||
[New in Symfony 2.6: Simpler Security Voters ](http://symfony.com/blog/new-in-symfony-2-6-simpler-security-voters)
|
||||
`New in Symfony 2.6: Simpler Security Voters <http://symfony.com/blog/new-in-symfony-2-6-simpler-security-voters>`_
|
||||
|
||||
From the symfony blog
|
||||
|
||||
##### Declare your role
|
||||
|
||||
Declare your role
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
interface ProvideRoleInterface
|
||||
{
|
||||
/**
|
||||
@@ -326,15 +375,21 @@ To declare new role, implement the class :class:`Chill\\MainBundle\\Security\\Pr
|
||||
public function getRolesWithoutScope();
|
||||
}
|
||||
|
||||
|
||||
Then declare your service with a tag `chill.role`. Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
your_service:
|
||||
class: Chill\YourBundle\Security\Authorization\YourVoter
|
||||
tags:
|
||||
- { name: chill.role }
|
||||
|
||||
|
||||
Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRoleInterface`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||
@@ -357,10 +412,13 @@ Example of an implementation of :class:`Chill\\MainBundle\\Security\\ProvideRole
|
||||
|
||||
}
|
||||
|
||||
##### Adding role hierarchy
|
||||
Adding role hierarchy
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You should prepend Symfony's security component directly from your code.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\DependencyInjection;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
@@ -392,7 +450,10 @@ You should prepend Symfony's security component directly from your code.
|
||||
}
|
||||
}
|
||||
|
||||
##### Implement your voter
|
||||
|
||||
|
||||
Implement your voter
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Most of the time, Voter will check that:
|
||||
|
||||
@@ -403,6 +464,7 @@ Most of the time, Voter will check that:
|
||||
|
||||
Thats what we call the "autorization logic". But this logic may be replace by a new one, and developers should take care of it.
|
||||
|
||||
|
||||
Then voter implementation should take care of:
|
||||
|
||||
* check the access to associated entities. For instance, if an ``Activity`` is associated to a ``Person``, the voter should first check that the user can show the associated ``Person``;
|
||||
@@ -410,6 +472,9 @@ Then voter implementation should take care of:
|
||||
|
||||
This is an example of implementation:
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
namespace Chill\DocStoreBundle\Security\Authorization;
|
||||
@@ -448,6 +513,7 @@ This is an example of implementation:
|
||||
->build();
|
||||
}
|
||||
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return $this->voterHelper->supports($attribute, $subject);
|
||||
@@ -487,6 +553,7 @@ This is an example of implementation:
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
{
|
||||
// ...
|
||||
@@ -495,6 +562,8 @@ This is an example of implementation:
|
||||
|
||||
Then, you will have to declare the service and tag it as a voter :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.report.security.authorization.report_voter:
|
||||
class: Chill\ReportBundle\Security\Authorization\ReportVoter
|
||||
@@ -503,13 +572,18 @@ Then, you will have to declare the service and tag it as a voter :
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
|
||||
## How to resolve scope and center programmatically ?
|
||||
|
||||
How to resolve scope and center programmatically ?
|
||||
==================================================
|
||||
|
||||
In a service, resolve the center and scope of an entity
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
|
||||
|
||||
|
||||
class MyService {
|
||||
private ScopeResolverDispatcher $scopeResolverDispatcher;
|
||||
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||
@@ -531,6 +605,8 @@ In a service, resolve the center and scope of an entity
|
||||
|
||||
In twig template, resolve the center:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{# resolve a center #}
|
||||
|
||||
{% if person|chill_resolve_center is not null%}
|
||||
@@ -552,6 +628,8 @@ In twig template, resolve the center:
|
||||
|
||||
In twig template, resolve the scope:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{% if entity|chill_is_scope_concerned %}
|
||||
|
||||
{% if entity|chill_resolve_scope is iterable %}
|
||||
@@ -567,7 +645,8 @@ In twig template, resolve the scope:
|
||||
{% endfor %}
|
||||
{%- endif -%}
|
||||
|
||||
### What is the default implementation of Scope and Center resolver ?
|
||||
What is the default implementation of Scope and Center resolver ?
|
||||
-----------------------------------------------------------------
|
||||
|
||||
By default, the implementation rely on association into entities.
|
||||
|
||||
@@ -578,14 +657,16 @@ By default, the implementation rely on association into entities.
|
||||
|
||||
Then, the default implementation will resolve the center and scope based on the implementation in your model.
|
||||
|
||||
### How to change the default behaviour ?
|
||||
How to change the default behaviour ?
|
||||
-------------------------------------
|
||||
|
||||
Implements those interface into services:
|
||||
|
||||
* ``Chill\MainBundle\Security\Resolver\CenterResolverInterface``;
|
||||
* ``Chill\MainBundle\Security\Resolver\ScopeResolverInterface``;
|
||||
|
||||
## Authorization into lists and index pages
|
||||
Authorization into lists and index pages
|
||||
========================================
|
||||
|
||||
Due to the fact that authorization model may be overriden, "list" and "index" pages should not rely on center and scope from controller. This must be delegated to dedicated service, which will be aware of the authorization model. We call them ``ACLAwareRepository``. This service must implements an interface, in order to allow to change the implementation.
|
||||
|
||||
@@ -593,11 +674,14 @@ The controller **must not** performs any DQL or SQL query.
|
||||
|
||||
Example in a controller:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\TaskBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface;
|
||||
|
||||
|
||||
final class SingleTaskController extends AbstractController
|
||||
{
|
||||
|
||||
@@ -645,9 +729,11 @@ Example in a controller:
|
||||
}
|
||||
}
|
||||
|
||||
### Writing ``ACLAwareRepository``
|
||||
Writing ``ACLAwareRepository``
|
||||
------------------------------
|
||||
|
||||
##### The ACLAwareRepository should rely on interfaces
|
||||
The ACLAwareRepository should rely on interfaces
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
As described above, the ACLAwareRepository will perform the query for listing entities, and take care of authorization.
|
||||
|
||||
@@ -657,6 +743,9 @@ The service must rely on this interface, and not on the default implementation.
|
||||
|
||||
Example: at first, we design an interface for listing ``SingleTask`` entities:
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
namespace Chill\TaskBundle\Repository;
|
||||
@@ -693,6 +782,8 @@ Example: at first, we design an interface for listing ``SingleTask`` entities:
|
||||
|
||||
Implements this interface and register the interface as an alias for the implementation.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
Chill\TaskBundle\Repository\SingleTaskAclAwareRepository:
|
||||
autowire: true
|
||||
@@ -700,7 +791,8 @@ Implements this interface and register the interface as an alias for the impleme
|
||||
|
||||
Chill\TaskBundle\Repository\SingleTaskAclAwareRepositoryInterface: '@Chill\TaskBundle\Repository\SingleTaskAclAwareRepository'
|
||||
|
||||
##### Write the basic implementation for re-use: separate authorization logic and search logic
|
||||
Write the basic implementation for re-use: separate authorization logic and search logic
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The logic of such repository may be separated into two logic:
|
||||
|
||||
@@ -711,6 +803,8 @@ This logic should be separated into your implementation.
|
||||
|
||||
Considering this simple interface:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
interface MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
public function countByAuthorized(array $criterias): int;
|
||||
@@ -721,11 +815,15 @@ Considering this simple interface:
|
||||
|
||||
The base implementation should separate the logic to allow an easy reuse. Here, the method ``buildQuery`` build a basic query without authorization logic, which can be re-used. The authorization logic is dedicated to a private method. For ease of user, the logic of adding ordering criterias and pagination parameters (``$start`` and ``$limit``) are also delegated to a public method.
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
|
||||
final class MyEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
@@ -777,12 +875,15 @@ The base implementation should separate the logic to allow an easy reuse. Here,
|
||||
|
||||
Once this logic is executed, it becomes easy to make a new implementation of the repository:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyOtherBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Chill\MyBundle\Repository\MyEntityACLAwareRepository
|
||||
|
||||
|
||||
final class AnotherEntityACLAwareRepository implements MyEntityACLAwareRepositoryInterface {
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
@@ -820,8 +921,14 @@ Once this logic is executed, it becomes easy to make a new implementation of the
|
||||
|
||||
Then, register this service and decorates the old one:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
Chill\MyOtherBundle\Repository\AnotherEntityACLAwareRepository:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
decorates: Chill\MyBundle\Repository\MyEntityACLAwareRepositoryInterface:
|
||||
decorates: Chill\MyBundle\Repository\MyEntityACLAwareRepositoryInterface:
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
# API
|
||||
.. 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.
|
||||
|
||||
###### Basic configuration
|
||||
Basic configuration
|
||||
*******************
|
||||
|
||||
## Configure a route
|
||||
Configure a route
|
||||
=================
|
||||
|
||||
Follow those steps to build a REST api:
|
||||
|
||||
@@ -14,29 +27,36 @@ Follow those steps to build a REST api:
|
||||
You can also:
|
||||
|
||||
* hook into the controller to customize some steps;
|
||||
* add more routes and 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)
|
||||
* `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>`_
|
||||
|
||||
## Autoloading the routes
|
||||
Auto-loading the routes
|
||||
=======================
|
||||
|
||||
Ensure that those lines are present in your file `app/config/routing.yml`:
|
||||
|
||||
```yaml
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_cruds:
|
||||
resource: 'chill_main_crud_route_loader:load'
|
||||
type: service
|
||||
```
|
||||
|
||||
## Create your model
|
||||
|
||||
Create your model in the usual way:
|
||||
Create your model
|
||||
=================
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
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;
|
||||
@@ -67,14 +87,16 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
// .. getters and setters
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Configure api
|
||||
|
||||
Configure the api using YAML (see the full configuration: [api_full_configuration](api_full_configuration.md)):
|
||||
Configure api
|
||||
=============
|
||||
|
||||
```yaml
|
||||
# config/packages/chill_main.yaml
|
||||
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:
|
||||
@@ -91,13 +113,15 @@ Configure the api using YAML (see the full configuration: [api_full_configuratio
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
```
|
||||
If you are working on a shared bundle (aka "The chill bundles"), you should define your configuration inside the class `ChillXXXXBundleExtension`, using the "prependConfig" feature:
|
||||
|
||||
```php
|
||||
.. 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;
|
||||
@@ -131,13 +155,13 @@ Configure the api using YAML (see the full configuration: [api_full_configuratio
|
||||
'base_role' => 'ROLE_USER',
|
||||
'actions' => [
|
||||
'_index' => [
|
||||
'methods' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true
|
||||
],
|
||||
],
|
||||
'_entity' => [
|
||||
'methods' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true
|
||||
]
|
||||
@@ -148,35 +172,37 @@ Configure the api using YAML (see the full configuration: [api_full_configuratio
|
||||
]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### The `_index` and `_entity` action
|
||||
The :code:`_index` and :code:`_entity` action
|
||||
*********************************************
|
||||
|
||||
The `_index` and `_entity` action are default actions:
|
||||
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: `chill_api_single_accompanying_period_origin__index`
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__index`
|
||||
|
||||
Path: `/api/1.0/person/accompanying-period/origin.{_format}`
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin.{_format}`
|
||||
|
||||
Entity:
|
||||
Name: `chill_api_single_accompanying_period_origin__entity`
|
||||
Name: :code:`chill_api_single_accompanying_period_origin__entity`
|
||||
|
||||
Path: `/api/1.0/person/accompanying-period/origin/{id}.{_format}`
|
||||
Path: :code:`/api/1.0/person/accompanying-period/origin/{id}.{_format}`
|
||||
|
||||
###### Role
|
||||
Role
|
||||
****
|
||||
|
||||
By default, the key `base_role` is used to check ACL. Take care of creating the `Voter` required to take that into account.
|
||||
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 `NULL` as `$subject`. The retrieved entity will be the subject for single queries.
|
||||
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.
|
||||
|
||||
```yaml
|
||||
# config/packages/chill_main.yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/packages/chill_main.yaml
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
@@ -191,13 +217,16 @@ You can also define a role for each method. In this case, this role is used for
|
||||
roles:
|
||||
GET: MY_ROLE_SEE
|
||||
HEAD: MY ROLE_SEE
|
||||
```
|
||||
|
||||
###### Customize the controller
|
||||
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
|
||||
|
||||
You can customize the controller by hooking into the default actions. Take care of extending `Chill\MainBundle\CRUD\Controller\ApiController`.
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
@@ -211,14 +240,14 @@ You can customize the controller by hooking into the default actions. Take care
|
||||
$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:
|
||||
|
||||
```yaml
|
||||
chill_main:
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
accompanying_period_origin:
|
||||
base_path: '/api/1.0/person/accompanying-period/origin'
|
||||
@@ -236,15 +265,15 @@ And set your controller in configuration:
|
||||
methods:
|
||||
GET: true
|
||||
HEAD: true
|
||||
```
|
||||
|
||||
###### Create your own actions
|
||||
Create your own actions
|
||||
***********************
|
||||
|
||||
You can add your own actions:
|
||||
|
||||
```yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
@@ -252,7 +281,7 @@ chill_main:
|
||||
base_path: /api/1.0/person/accompanying-course
|
||||
controller: Chill\PersonBundle\Controller\AccompanyingCourseApiController
|
||||
actions:
|
||||
# add custom participation:
|
||||
# add a custom participation:
|
||||
participation:
|
||||
methods:
|
||||
POST: true
|
||||
@@ -267,13 +296,13 @@ chill_main:
|
||||
HEAD: null
|
||||
PUT: null
|
||||
single-collection: single
|
||||
```
|
||||
|
||||
The key `single-collection` with value `single` will add a `/{id}/ + "action name"` (in this example, `/{id}/participation`) into the path, after the base path. If the value is `collection`, no id will be set, but the action name will be append to the path.
|
||||
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:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
@@ -297,10 +326,10 @@ Then, create the corresponding action into your controller:
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
|
||||
public function participationApi($id, Request $request, $_format)
|
||||
{
|
||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||
$accompanyingPeriod = $this->getEntity('participation', $id, $request);
|
||||
$person = $this->getSerializer()
|
||||
->deserialize($request->getContent(), Person::class, $_format, []);
|
||||
@@ -334,18 +363,20 @@ Then, create the corresponding action into your controller:
|
||||
return $this->json($participation);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### Managing association
|
||||
Managing association
|
||||
********************
|
||||
|
||||
## ManyToOne association
|
||||
ManyToOne association
|
||||
=====================
|
||||
|
||||
In ManyToOne association, you can add associated entities using the `PATCH` request. By default, the serializer deserialize entities only with their id and discriminator type, if any.
|
||||
In ManyToOne association, you can add associated entities using the :code:`PATCH` request. By default, the serializer deserialize entities only with their id and discriminator type, if any.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
curl -X 'PATCH' \
|
||||
.. code-block:: bash
|
||||
|
||||
curl -X 'PATCH' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2668.json' \
|
||||
-H 'accept: */*' \
|
||||
-H 'Content-Type: application/json' \
|
||||
@@ -355,15 +386,16 @@ curl -X 'PATCH' \
|
||||
"id": 2668,
|
||||
"origin": { "id": 11 }
|
||||
}'
|
||||
```
|
||||
|
||||
## ManyToMany associations
|
||||
ManyToMany associations
|
||||
=======================
|
||||
|
||||
In OneToMany association, you can easily create route for adding and removing entities, using `POST` and `DELETE` requests.
|
||||
In OneToMany association, you can easily create route for adding and removing entities, using :code:`POST` and :code:`DELETE` requests.
|
||||
|
||||
Prepare your entity, creating the methods `addYourEntity` and `removeYourEntity`:
|
||||
Prepare your entity, creating the methods :code:`addYourEntity` and :code:`removeYourEntity`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
@@ -405,12 +437,12 @@ Prepare your entity, creating the methods `addYourEntity` and `removeYourEntity`
|
||||
{
|
||||
$this->scopes->removeElement($scope);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Create your route into the configuration:
|
||||
|
||||
```yaml
|
||||
# config/packages/chill_main.yaml`
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
apis:
|
||||
-
|
||||
@@ -437,12 +469,14 @@ Create your route into the configuration:
|
||||
controller_action: null
|
||||
path: null
|
||||
single-collection: single
|
||||
```
|
||||
|
||||
This will create a new route, which will accept two methods: DELETE and POST:
|
||||
|
||||
.. code-block:: raw
|
||||
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Property | Value |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
| Route Name | chill_api_single_accompanying_course_scope |
|
||||
| Path | /api/1.0/person/accompanying-course/{id}/scope.{_format} |
|
||||
| Path Regex | {^/api/1\.0/person/accompanying\-course/(?P<id>[^/]++)/scope\.(?P<_format>[^/]++)$}sD |
|
||||
@@ -454,10 +488,14 @@ This will create a new route, which will accept two methods: DELETE and POST:
|
||||
| Class | Symfony\Component\Routing\Route |
|
||||
| Defaults | _controller: csapi_accompanying_course_controller:scopeApi |
|
||||
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
|
||||
+--------------+---------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
Then, create the controller action. Call the method:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
@@ -472,14 +510,14 @@ Then, create the controller action. Call the method:
|
||||
return $this->addRemoveSomething('scope', $id, $request, $_format, 'scope', Scope::class, [ 'groups' => [ 'read' ] ]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This will allow adding a scope by his id and deleting them.
|
||||
This will allow to add a scope by his id, and delete them.
|
||||
|
||||
Curl requests:
|
||||
|
||||
```
|
||||
# add a scope with id 5
|
||||
.. code-block:: bash
|
||||
|
||||
# add a scope with id 5
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8001/api/1.0/person/accompanying-course/2868/scope.json' \
|
||||
-H 'accept: */*' \
|
||||
@@ -498,13 +536,14 @@ Curl requests:
|
||||
"id": 5,
|
||||
"type": "scope"
|
||||
}'
|
||||
```
|
||||
|
||||
## Deserializing an association where multiple types are allowed
|
||||
Deserializing an association where multiple types are allowed
|
||||
=============================================================
|
||||
|
||||
Sometimes, multiple types are allowed as association to one entity:
|
||||
Sometimes, multiples types are allowed as association to one entity:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -514,6 +553,7 @@ Sometimes, multiple types are allowed as association to one entity:
|
||||
class Resource
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
@@ -526,6 +566,7 @@ Sometimes, multiple types are allowed as association to one entity:
|
||||
*/
|
||||
private $person;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $resource Person|ThirdParty
|
||||
@@ -534,8 +575,8 @@ Sometimes, multiple types are allowed as association to one entity:
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return ThirdParty|Person
|
||||
* @Groups({"read", "write"})
|
||||
@@ -545,13 +586,13 @@ Sometimes, multiple types are allowed as association to one entity:
|
||||
return $this->person ?? $this->thirdParty;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
This is not well taken into account by the Symfony serializer natively.
|
||||
|
||||
You must, then, create your own CustomNormalizer. You can help yourself using this:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -565,6 +606,7 @@ You must, then, create your own CustomNormalizer. You can help yourself using th
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
use Chill\MainBundle\Serializer\Normalizer\DiscriminatedObjectDenormalizer;
|
||||
|
||||
|
||||
class AccompanyingPeriodResourceNormalizer implements DenormalizerInterface, DenormalizerAwareInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
@@ -590,34 +632,35 @@ You must, then, create your own CustomNormalizer. You can help yourself using th
|
||||
DiscriminatedObjectDenormalizer::TYPE,
|
||||
$format,
|
||||
// into the context, we add the list of allowed types:
|
||||
[
|
||||
DiscriminatedObjectDenormalizer::ALLOWED_TYPES =>
|
||||
[
|
||||
[
|
||||
DiscriminatedObjectDenormalizer::ALLOWED_TYPES =>
|
||||
[
|
||||
Person::class, ThirdParty::class
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
$resource->setResource($res);
|
||||
}
|
||||
}
|
||||
|
||||
return $resource;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function supportsDenormalization($data, string $type, string $format = null)
|
||||
{
|
||||
return $type === Resource::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### Serialization for collection
|
||||
Serialization for collection
|
||||
****************************
|
||||
|
||||
A specific model has been defined for returning collection:
|
||||
|
||||
```
|
||||
{
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"count": 49,
|
||||
"results": [
|
||||
],
|
||||
@@ -629,13 +672,13 @@ A specific model has been defined for returning collection:
|
||||
"items_per_page": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where this is relevant, this model should be re-used in custom controller actions.
|
||||
|
||||
In custom actions, this can be achieved quickly by assembling results into a `Chill\MainBundle\Serializer\Model\Collection`. The pagination information is given by using `Paginator` (see [Pagination ](pagination-ref.md)).
|
||||
In custom actions, 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
|
||||
|
||||
```php
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
|
||||
@@ -649,11 +692,15 @@ In custom actions, this can be achieved quickly by assembling results into a `Ch
|
||||
return $this->json($model, Response::HTTP_OK, [], $context);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### Full configuration example
|
||||
|
||||
```yaml
|
||||
.. _api_full_configuration:
|
||||
|
||||
Full configuration example
|
||||
**************************
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
apis:
|
||||
-
|
||||
class: Chill\PersonBundle\Entity\AccompanyingPeriod
|
||||
@@ -696,4 +743,5 @@ In custom actions, this can be achieved quickly by assembling results into a `Ch
|
||||
path: null
|
||||
single-collection: single
|
||||
base_role: null
|
||||
```
|
||||
|
||||
|
||||
@@ -1,61 +1,91 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
.. 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".
|
||||
|
||||
# Assets
|
||||
.. _forms:
|
||||
|
||||
Assets
|
||||
#######
|
||||
|
||||
The Chill assets (js, css, images, …) can be managed by `Webpack Encore`_, which is a thin wrapper for `Webpack`_ in Symfony applications.
|
||||
|
||||
###### Installation
|
||||
Installation
|
||||
************
|
||||
|
||||
Webpack Encore needs to be run in a Node.js environment, using the Yarn package manager. This Node.js environment can be set up using a node docker image. The bash script `docker-node.sh` set up a Node.js environment with an adequate configuration. Launch this container by typing:
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ bash docker-node.sh
|
||||
|
||||
In this NodeJS environment, install all the assets required by Chill with:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn install
|
||||
|
||||
This command will install all the packages that are listed in `package.json`.
|
||||
|
||||
Any further required dependencies can be installed using the Yarn package. For instance, jQuery is installed by:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn add jquery --dev
|
||||
|
||||
###### Usage
|
||||
|
||||
### Organize your assets
|
||||
Usage
|
||||
*****
|
||||
|
||||
Organize your assets
|
||||
--------------------
|
||||
|
||||
Chill assets usually lives under the `/Resources/public` folder of each Chill bundle. The Webpack configuration set up in `webpack.config.js` automatically loads the required assets from the Chill bundles that are used.
|
||||
|
||||
For adding your own assets to Webpack, you must add an entry in the `webpack.config.js` file. For instance, the following entry will output a file `main.js` collecting the js code (and possibly css, image, etc.) from `./assets/main.js`.
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
.addEntry('main', './assets/main.js')
|
||||
|
||||
To gather the css files, simply connect them to your js file, using `require`. The css file is seen as a dependency of your js file. :
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// assets/js/main.js
|
||||
require('../css/app.css');
|
||||
|
||||
For finer configuration of webpack encore, we refer to the above-linked documentation.
|
||||
|
||||
### Compile the assets
|
||||
|
||||
Compile the assets
|
||||
------------------
|
||||
|
||||
To compile the assets, run this line in the NodeJS container:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn run encore dev
|
||||
|
||||
While developing, you can tell Webpack Encore to continuously watch the files you are modifying:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
node@b91cab4f7cfc:/app$ yarn run encore dev --watch
|
||||
|
||||
### Use the assets in the templates
|
||||
|
||||
Use the assets in the templates
|
||||
--------------------------------
|
||||
|
||||
Any entry defined in the webpack.config.js file can be linked to your application using the symfony `asset` helper:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<head>
|
||||
...
|
||||
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
|
||||
@@ -63,4 +93,12 @@ Any entry defined in the webpack.config.js file can be linked to your applicatio
|
||||
<body>
|
||||
...
|
||||
<script src="{{ asset('build/app.js') }}"></script>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore
|
||||
.. _Webpack: https://webpack.js.org/
|
||||
@@ -1,23 +0,0 @@
|
||||
# Code style, code quality and other tools
|
||||
|
||||
## PHP-cs-fixer
|
||||
|
||||
For development, you will also have to install:
|
||||
|
||||
- [php-cs-fixer ](https://cs.symfony.com/)
|
||||
|
||||
We also encourage you to use tools like [phpstan ](https://phpstan.org) and [rector ](https://getrector.com).
|
||||
|
||||
For running php-cs-fixer:
|
||||
|
||||
symfony composer php-cs-fixer
|
||||
|
||||
## Execute tests
|
||||
|
||||
symfony composer exec phpunit -- /path/to_your_test.php
|
||||
|
||||
Note that IDE like PhpStorm should be able to run tests, even KernelTestcase or WebTestCase, [from within their interfaces ](https://www.jetbrains.com/help/phpstorm/using-phpunit-framework.html#run_phpunit_tests).
|
||||
|
||||
## Execute rector
|
||||
|
||||
symfony composer exec rector -- process
|
||||
34
docs/source/development/code-quality.rst
Normal file
34
docs/source/development/code-quality.rst
Normal file
@@ -0,0 +1,34 @@
|
||||
Code style, code quality and other tools
|
||||
########################################
|
||||
|
||||
PHP-cs-fixer
|
||||
============
|
||||
|
||||
For development, you will also have to install:
|
||||
|
||||
- `php-cs-fixer <https://cs.symfony.com/>`_
|
||||
|
||||
We also encourage you to use tools like `phpstan <https://phpstan.org>`_ and `rector <https://getrector.com>`_.
|
||||
|
||||
For running php-cs-fixer:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
symfony composer php-cs-fixer
|
||||
|
||||
Execute tests
|
||||
=============
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
symfony composer exec phpunit -- /path/to_your_test.php
|
||||
|
||||
Note that IDE like PhpStorm should be able to run tests, even KernelTestcase or WebTestCase, `from within their interfaces <https://www.jetbrains.com/help/phpstorm/using-phpunit-framework.html#run_phpunit_tests>`_.
|
||||
|
||||
Execute rector
|
||||
==============
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
symfony composer exec rector -- process
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
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".
|
||||
|
||||
###### Create a new bundle
|
||||
|
||||
Create your own bundle is not a trivial task.
|
||||
|
||||
The easiest way to achieve this is seems to be :
|
||||
|
||||
1. Prepare a fresh installation of the chill project, in a new directory
|
||||
2. Create a new bundle in this project, in the src directory
|
||||
3. Initialize a git repository **at the root bundle**, and create your initial commit.
|
||||
4. Register the bundle with composer/packagist. If you do not plan to distribute your bundle with packagist, you may use a custom repository for achieve this [#f1]_
|
||||
5. Move to a development installation, made as described in the [installation-for-development` section, and add your new repository to the composer.json file
|
||||
6. Work as :ref:`usual ](editing-code-and-commiting.md)
|
||||
|
||||
This part of the doc is not yet tested
|
||||
|
||||
TODO
|
||||
104
docs/source/development/create-a-new-bundle.rst
Normal file
104
docs/source/development/create-a-new-bundle.rst
Normal file
@@ -0,0 +1,104 @@
|
||||
.. 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".
|
||||
|
||||
.. _create-new-bundle:
|
||||
|
||||
Create a new bundle
|
||||
*******************
|
||||
|
||||
.. warning::
|
||||
|
||||
This part of the doc is not yet tested
|
||||
|
||||
Create a new directory with Bundle class
|
||||
----------------------------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
mkdir -p src/Bundle/ChillSomeBundle/src/config
|
||||
mkdir -p src/Bundle/ChillSomeBundle/src/Controller
|
||||
|
||||
Add a bundle file
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Chill\SomeBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillSomeBundle extends Bundle {}
|
||||
|
||||
And a route file:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_ticket_controller:
|
||||
resource: '@ChillTicketBundle/Controller/'
|
||||
type: annotation
|
||||
|
||||
Register the new psr-4 namespace
|
||||
--------------------------------
|
||||
|
||||
In composer.json, add the new psr4 namespace
|
||||
|
||||
.. code-block:: diff
|
||||
|
||||
{
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
+ "Chill\\SomeBundle\\": "src/Bundle/ChillSomeBundle/src",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Register the bundle
|
||||
-------------------
|
||||
|
||||
Register in the file :code:`config/bundles.php`:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
Vendor\Bundle\YourBundle\YourBundle::class => ['all' => true],
|
||||
|
||||
And import routes in :code:`config/routes/chill_some_bundle.yaml`:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_ticket_bundle:
|
||||
resource: '@ChillSomeBundle/config/routes.yaml'
|
||||
|
||||
Add the doctrine_migration namespace
|
||||
------------------------------------
|
||||
|
||||
Add the namespace to :code:`config/packages/doctrine_migrations_chill.yaml`
|
||||
|
||||
.. code-block:: diff
|
||||
|
||||
doctrine_migrations:
|
||||
migrations_paths:
|
||||
+ 'Chill\Some\Ticket': '@ChillSomeBundle/migrations'
|
||||
|
||||
Dump autoloading
|
||||
----------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
symfony composer dump-autoload
|
||||
|
||||
@@ -1,26 +1,37 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
.. Copyright (C) 2014-2023 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".
|
||||
|
||||
###### Cron jobs
|
||||
.. _cronjob:
|
||||
|
||||
Cron jobs
|
||||
*********
|
||||
|
||||
Some tasks must be executed regularly: refresh some materialized views, remove old data, ...
|
||||
|
||||
For this purpose, one can programmatically implements a "cron job", which will be scheduled by a specific command.
|
||||
|
||||
## The command `chill:cron-job:execute`
|
||||
The command :code:`chill:cron-job:execute`
|
||||
==========================================
|
||||
|
||||
The command `chill:cron-job:execute` will schedule a task, one by one. In a classical implementation, it should
|
||||
The command :code:`chill:cron-job:execute` will schedule a task, one by one. In a classical implementation, it should
|
||||
be executed every 15 minutes (more or less), to ensure that every task can be executed.
|
||||
|
||||
.. warning::
|
||||
|
||||
This command should not be executed in parallel. The installer should ensure that two job are executed concurrently.
|
||||
|
||||
## How to implements a cron job ?
|
||||
How to implements a cron job ?
|
||||
==============================
|
||||
|
||||
Implements a `Chill\MainBundle\Cron\CronJobInterface`. Here is an example:
|
||||
Implements a :code:`Chill\MainBundle\Cron\CronJobInterface`. Here is an example:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\Service\Something;
|
||||
|
||||
@@ -72,15 +83,19 @@ Implements a `Chill\MainBundle\Cron\CronJobInterface`. Here is an example:
|
||||
}
|
||||
}
|
||||
|
||||
## How are cron job scheduled ?
|
||||
How are cron job scheduled ?
|
||||
============================
|
||||
|
||||
If the command `chill:cron-job:execute` is run with one or more `job` argument, those jobs are run, **without checking that the job can run** (the method `canRun` is not executed).
|
||||
If the command :code:`chill:cron-job:execute` is run with one or more :code:`job` argument, those jobs are run, **without checking that the job can run** (the method :code:`canRun` is not executed).
|
||||
|
||||
If any `job` argument is given, the `CronManager` schedule job with those steps:
|
||||
If any :code:`job` argument is given, the :code:`CronManager` schedule job with those steps:
|
||||
|
||||
* the tasks are ordered, with:
|
||||
* a priority is given for tasks that weren't never executed;
|
||||
* then, the tasks are ordered, the last executed are the first in the list
|
||||
* then, for each tasks, and in the given order, the first task where `canRun` return `TRUE` will be executed.
|
||||
* then, for each tasks, and in the given order, the first task where :code:`canRun` return :code:`TRUE` will be executed.
|
||||
|
||||
The command :code:`chill:cron-job:execute` execute **only one** task.
|
||||
|
||||
|
||||
|
||||
The command `chill:cron-job:execute` execute **only one** task.
|
||||
@@ -1,11 +1,15 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
.. 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".
|
||||
|
||||
# CRUD
|
||||
.. _crud:
|
||||
|
||||
CRUD
|
||||
####
|
||||
|
||||
Chill provide an API to create a basic CRUD.
|
||||
|
||||
@@ -16,21 +20,30 @@ One can follow those steps to create a CRUD for one entity:
|
||||
3. customize the templates if required ;
|
||||
4. customize some steps of the controller if required ;
|
||||
|
||||
An example with the [`ClosingMotive`` (PersonBundle) in the admin part of Chill:
|
||||
|
||||
###### Auto-loading the routes
|
||||
An example with the ``ClosingMotive`` (PersonBundle) in the admin part of Chill:
|
||||
|
||||
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
|
||||
*****************
|
||||
|
||||
Create your model on the usual way (in this example, ORM informations are stored in yaml file):
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@@ -49,40 +62,41 @@ Create your model on the usual way (in this example, ORM informations are stored
|
||||
* @var array
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var self
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
|
||||
/**
|
||||
* child Accompanying periods
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
private $children;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $ordering = 0.0;
|
||||
|
||||
|
||||
// getters and setters come here
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
The form:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@@ -94,7 +108,8 @@ The form:
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
|
||||
/**
|
||||
###### *
|
||||
*
|
||||
*
|
||||
*/
|
||||
class ClosingMotiveType extends AbstractType
|
||||
{
|
||||
@@ -130,21 +145,22 @@ The form:
|
||||
;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### Configure the crud
|
||||
Configure the crud
|
||||
******************
|
||||
|
||||
The crud is configured using the key ``crud`` under ``chill_main``
|
||||
|
||||
```yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
cruds:
|
||||
-
|
||||
-
|
||||
# the class which is concerned by the CRUD
|
||||
class: '\Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive::class'
|
||||
# give a name for the crud. This will be used internally
|
||||
name: closing_motive
|
||||
# add a base path for the
|
||||
# add a base path for the
|
||||
base_path: /admin/closing-motive
|
||||
# this is the form class
|
||||
form_class: 'Chill\PersonBundle\Form\ClosingMotiveType::class'
|
||||
@@ -154,8 +170,8 @@ The crud is configured using the key ``crud`` under ``chill_main``
|
||||
# this is a list of action you can configure
|
||||
# by default, the actions `index`, `view`, `new` and `edit` are automatically create
|
||||
# you can add more actions or configure some details about them
|
||||
actions:
|
||||
index:
|
||||
actions:
|
||||
index:
|
||||
# the default template for index is very poor,
|
||||
# you will need to override it
|
||||
template: '@ChillPerson/ClosingMotive/index.html.twig'
|
||||
@@ -164,16 +180,16 @@ The crud is configured using the key ``crud`` under ``chill_main``
|
||||
new:
|
||||
role: ROLE_ADMIN
|
||||
# by default, the template will only show the form
|
||||
# you can override it
|
||||
# you can override it
|
||||
template: '@ChillPerson/ClosingMotive/new.html.twig'
|
||||
edit:
|
||||
role: ROLE_ADMIN
|
||||
template: '@ChillPerson/ClosingMotive/edit.html.twig'
|
||||
```
|
||||
|
||||
To leave the bundle autoconfigure the ``chill_main`` bundle, you can `prepend the configuration of the ChillMain Bundle ](https://symfony.com/doc/current/bundles/prepend_extension.html):
|
||||
To leave the bundle auto-configure the ``chill_main`` bundle, you can `prepend the configuration of the ChillMain Bundle <https://symfony.com/doc/current/bundles/prepend_extension.html>`_:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@@ -188,13 +204,13 @@ To leave the bundle autoconfigure the ``chill_main`` bundle, you can `prepend th
|
||||
{
|
||||
// skipped here
|
||||
}
|
||||
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependCruds($container);
|
||||
}
|
||||
|
||||
|
||||
protected function prependCruds(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
@@ -224,17 +240,20 @@ To leave the bundle autoconfigure the ``chill_main`` bundle, you can `prepend th
|
||||
]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### Customize templates
|
||||
|
||||
The current template is quite basic. You can override and extends them.
|
||||
|
||||
Customize templates
|
||||
*******************
|
||||
|
||||
The current template are quite basic. You can override and extends them.
|
||||
|
||||
For a better inclusion, you can embed them instead of extending them.
|
||||
|
||||
For index. Note that we extend here the `admin` layout, not the default one:
|
||||
|
||||
```php
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block admin_content %}
|
||||
@@ -269,11 +288,11 @@ For index. Note that we extend here the `admin` layout, not the default one:
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
For edit template:
|
||||
|
||||
```php
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
@@ -290,6 +309,8 @@ For edit template:
|
||||
|
||||
For new template:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
@@ -301,16 +322,17 @@ For new template:
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
###### Customize some steps in the controller
|
||||
Customize some steps in the controller
|
||||
**************************************
|
||||
|
||||
Some steps may be customized by overriding the default controller and some methods. Here, we will override the way the entity is created, and the ordering of the "index" page:
|
||||
|
||||
* we will associate a parent ClosingMotive to the element if a parameter `parent_id` is found ;
|
||||
* we will order the ClosingMotive by the ``ordering`` property
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
@@ -354,13 +376,14 @@ Some steps may be customized by overriding the default controller and some metho
|
||||
return $query->orderBy('e.ordering', 'ASC');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
###### How-to and questions
|
||||
How-to and questions
|
||||
********************
|
||||
|
||||
## Which role is required for each action ?
|
||||
Which role is required for each action ?
|
||||
========================================
|
||||
|
||||
By default, each action will use:
|
||||
By default, each action will use:
|
||||
|
||||
1. the role defined under the action key ;
|
||||
2. the base role as upper, with the action name appended:
|
||||
@@ -373,21 +396,22 @@ By default, each action will use:
|
||||
The entity will be passed to the role:
|
||||
|
||||
* for the ``view`` and ``edit`` action: the entity fetched from database
|
||||
* for the ``new`` action: the entity which is created (you can override default values using
|
||||
* for index action (or if you re-use the ``indexAction`` method: ``null``
|
||||
|
||||
## How to add some route and actions ?
|
||||
* for the ``new`` action: the entity which is created (you can override default values using
|
||||
* for index action (or if you re-use the ``indexAction`` method: ``null``
|
||||
|
||||
How to add some route and actions ?
|
||||
===================================
|
||||
|
||||
Add them under the action key:
|
||||
|
||||
```yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
cruds:
|
||||
-
|
||||
-
|
||||
# snipped
|
||||
actions:
|
||||
myaction: ~
|
||||
```
|
||||
|
||||
The method `myactionAction` will be called by the parameter.
|
||||
|
||||
@@ -395,12 +419,13 @@ Inside this action, you can eventually call another internal method:
|
||||
|
||||
* ``indexAction`` for a list of items ;
|
||||
* ``viewAction`` for a view
|
||||
* ``editFormAction`` for an edition
|
||||
* ``editFormAction`` for an edition
|
||||
* ``createFormAction`` for a creation
|
||||
|
||||
Example:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace CSConnectes\SPBundle\Controller;
|
||||
|
||||
use Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController;
|
||||
@@ -431,29 +456,34 @@ Example:
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## How to create a CRUD for entities associated to persons
|
||||
How to create a CRUD for entities associated to persons
|
||||
=======================================================
|
||||
|
||||
The bundle person provide some controller and template you can override, instead of the ones present in the mainbundle:
|
||||
|
||||
* `Chill\PersonBundle\CRUD\Controller\EntityPersonCRUDController` for entities linked with a one-to-may association to `Person` class ;
|
||||
* `Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController` for entities linked with a one-to-one association to `Person` class.
|
||||
* :code:`Chill\PersonBundle\CRUD\Controller\EntityPersonCRUDController` for entities linked with a one-to-may association to :code:`Person` class ;
|
||||
* :code:`Chill\PersonBundle\CRUD\Controller\OneToOneEntityPersonCRUDController` for entities linked with a one-to-one association to :code:`Person` class.
|
||||
|
||||
There are also template defined under ``@ChillPerson/CRUD/`` namespace.
|
||||
|
||||
Those controllers assume that:
|
||||
Those controller assume that:
|
||||
|
||||
* the entity provide the method `getPerson` and `setPerson` ;
|
||||
* the entity provide the method :code:`getPerson` and :code:`setPerson` ;
|
||||
* the `index`'s id path will be the id of the person, and the ids in `view` and `edit` path will be the id of the entity ;
|
||||
|
||||
This bundle also uses by default the templates inside ``@ChillPerson/CRUD/``.
|
||||
This bundle also use by default the templates inside ``@ChillPerson/CRUD/``.
|
||||
|
||||
###### Reference
|
||||
|
||||
## Configuration reference
|
||||
Reference
|
||||
*********
|
||||
|
||||
Configuration reference
|
||||
=======================
|
||||
|
||||
|
||||
.. code-block:: txt
|
||||
|
||||
```yaml
|
||||
chill_main:
|
||||
cruds:
|
||||
|
||||
@@ -484,8 +514,9 @@ This bundle also uses by default the templates inside ``@ChillPerson/CRUD/``.
|
||||
|
||||
# the template to render the view
|
||||
template: null
|
||||
```
|
||||
|
||||
## Twig default block
|
||||
Twig default block
|
||||
==================
|
||||
|
||||
This part should be documented.
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
# Database Principles
|
||||
|
||||
This page provides a global understanding of the Chill database and explains some implementation details that help accelerate processing from the database or exploit it more easily.
|
||||
|
||||
!!! warning "Database Schema Stability"
|
||||
The stability of the database schema is not guaranteed.
|
||||
|
||||
However, it evolves relatively little. It is rare for tables or columns to be deleted or renamed, but it is not guaranteed that this cannot happen.
|
||||
|
||||
## Overview
|
||||
|
||||
A commented list of all tables is available in CSV format at `./database/table_list.csv`.
|
||||
|
||||
### Schema and naming conventions
|
||||
|
||||
At the beginning of Chill's history, PostgreSQL schemas were not used. Data was stored in the `public` schema.
|
||||
|
||||
Later, new bundles appeared, and tables were classified into dedicated schemas.
|
||||
|
||||
Currently:
|
||||
|
||||
- for older bundles, those that already have tables in the public schema, new tables are added to this schema. They are prefixed with `chill_<bundle_name>_`;
|
||||
- for more recent bundles, tables are created in the dedicated schema
|
||||
|
||||
### Historical data
|
||||
|
||||
Some data is historized:
|
||||
|
||||
- the referents of an accompanying period;
|
||||
- the statuses of an accompanying period;
|
||||
- the link between territories and users;
|
||||
- etc.
|
||||
|
||||
In these cases, Chill generally creates two columns, which are usually named `startDate` and `endDate`. When the `endDate` column is `NULL`, it means that the period is not "closed". The `startDate` column is not nullable.
|
||||
|
||||
In some cases, the current data (referent of an accompanying period, for example) is also repeated at the table level itself. For example, the accompanying periods table `chill_person_accompanying_period` has a `step` column (the status of the period) and `user_id` (referent id) in addition to the history. Although redundant, this simplifies processing.
|
||||
|
||||
## Special relationships
|
||||
|
||||
### Users, households, addresses
|
||||
|
||||
Users have an address through households: in the interface, the address is recorded in the household file, and it is "given" to users who are members of the household, **and** who share the address of this household. Indeed, it is possible that users "belong" to a household without being domiciled there: this is the case, for example, for children in shared custody.
|
||||
|
||||
The history of users' membership in the household is preserved, as well as the history of addresses for the same household.
|
||||
|
||||
The tables involved are as follows:
|
||||
|
||||
- the `chill_person_person` table lists the users;
|
||||
- the `chill_person_household_members` table lists household memberships: this is the junction between users and households:
|
||||
- the `startDate` and `endDate` columns indicate the start and end date of membership;
|
||||
- the `shareHousehold` column indicates whether the user shares the household address (if yes, its value is `TRUE`)
|
||||
- the `chill_person_household` table lists households
|
||||
- the `chill_person_household_to_addresses` table associates households with addresses;
|
||||
- the `chill_main_address` table contains addresses, indicating the validity start date (`validFrom`) and the validity end date (`validTo`).
|
||||
|
||||
To simplify the resolution of addresses and users, two views have been implemented:
|
||||
|
||||
- the `view_chill_person_household_address` view takes up, for each user, the history of household memberships broken down by the address history of a household.
|
||||
In other words, a line is created each time a user changes household, or a household changes address. It is therefore possible to find the complete address history for a given user via this table.
|
||||
- the `view_chill_person_current_address` view takes up the current address of users.
|
||||
|
||||
### Addresses and geographical units
|
||||
|
||||
Chill provides statistics on the location of addresses relative to geographical zones (`chill_main_geographical_unit`).
|
||||
|
||||
Since the geographical resolution of addresses is costly in CPU and processing time, a materialized view has been created: `view_chill_main_address_geographical_unit`. It is refreshed daily in the production database.
|
||||
|
||||
## Table list and comments
|
||||
|
||||
A commented list of all tables is available in CSV format at `./database/table_list.csv`.
|
||||
84
docs/source/development/database-principles.rst
Normal file
84
docs/source/development/database-principles.rst
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
.. database-principles:
|
||||
|
||||
Principes de la base de données
|
||||
###############################
|
||||
|
||||
Cette page donne une compréhension globale de la base de donnée de Chill, et explique quelques détails d'implémentations qui permettent d'accélérer les traitements à partir de la base de donnée, ou de l'exploiter plus aisément.
|
||||
|
||||
Cette page est rédigée en français.
|
||||
|
||||
.. note::
|
||||
|
||||
La stabilité du schéma de la base de donnée n'est pas garantie.
|
||||
|
||||
Toutefois, ce dernier évolue relativement peu. Il est rare que des tables ou des colonnes soient supprimées ou renommées. Mais il n'est pas garanti que cela puisse arriver.
|
||||
|
||||
Généralités
|
||||
===========
|
||||
|
||||
Une liste commentée de toutes les tables :download:`est disponible au format CSV <./database/table_list.csv`.
|
||||
|
||||
Schéma et conventions de nommage
|
||||
--------------------------------
|
||||
|
||||
Au début de l'histoire de Chill, les schémas postgresql n'étaient pas exploités. Les données étaient stockées dans le schéma :code:`public`.
|
||||
|
||||
Par la suite, des nouveaux bundles sont apparus, et les tables ont été classées dans des schémas dédiés.
|
||||
|
||||
A l'heure actuelle:
|
||||
|
||||
- pour les anciens bundle, ceux qui ont déjà des tables dans le schéma public, les nouvelles tables sont ajoutées à ce schéma. Elles sont préfixées par :code:`chill_<nom du bundle>_`;
|
||||
- pour les bundles plus récents, les tables sont créées dans le schéma dédié
|
||||
|
||||
Données avec de l'historicité
|
||||
-----------------------------
|
||||
|
||||
Certaines données sont historisées:
|
||||
|
||||
- les référents d'un parcours;
|
||||
- les statuts d'un parcours;
|
||||
- la liaison entre les territoires et les usagers;
|
||||
- etc.
|
||||
|
||||
Dans ces cas-là, Chill crée généralement deux colonnes, qui sont habituellement nommées :code:`startDate` et :code:`endDate`. Lorsque la colonne :code:`endDate` est à :code:`NULL`, cela signifie que la période n'est pas "fermée". La colonne :code:`startDate` n'est pas nullable.
|
||||
|
||||
Dans certains cas, la donnée actuelle (référent d'un parcours, par exemple) est également répétée au niveau de la table en elle-même. Par exemple, la table des parcours :code:`chill_person_accompanying_period` comporte une colonne :code:`step` (le statut du parcours) et :code:`user_id` (id du référent) en plus de l'historique. Bien que redondant, cela simplifie les traitements.
|
||||
|
||||
Relations particulières
|
||||
=======================
|
||||
|
||||
Usagers, ménages, adresses
|
||||
--------------------------
|
||||
|
||||
Les usagers ont une adresse au travers des ménages: dans l'interface, l'adresse est inscrite dans le dossier du ménage, et elle est "donnée" aux usagers membres du ménage, **et** qui partagent l'adresse de ce ménage. En effet, il est possible que des usagers "appartiennent" à un ménage sans y être domicilié: c'est le cas, par exemple, des enfants en garde alternée.
|
||||
|
||||
L'historique de l'appartenance des usagers au ménage est conservée, de même que l'historique des adresses pour un même ménage.
|
||||
|
||||
Les tables en jeu sont les suivantes:
|
||||
|
||||
- la table :code:`chill_person_person` liste les usagers;
|
||||
- la table :code:`chill_person_household_members` liste les appartenances au ménage: il s'agit de la jointure entre les usagers et les ménages:
|
||||
- les colonnes :code:`startDate` et :code:`endDate` indiquent la date de début et la date de fin de l'appartenance;
|
||||
- la colonne :code:`shareHousehold` indique si l'utilisateur partage l'adresse du ménage (si oui, sa valeur est :code:`TRUE`)
|
||||
- la table :code:`chill_person_household` liste les ménages
|
||||
- la table :code:`chill_person_household_to_addresses` associe les ménages aux adresses;
|
||||
- la table :code:`chill_main_address` contient les adresses, en indiquant la date de début de validité (:code:`validFrom`) et la fin de validité (:code:`validTo`).
|
||||
|
||||
Pour simplifier la résolution des adresses et des usagers, deux vues ont été mises en œuvre:
|
||||
|
||||
- la vue :code:`view_chill_person_household_address` reprend, pour chaque usager, l'historique des appartenances au ménage découpée par l'historique des adresses d'un ménage.
|
||||
Autrement dit, une ligne est créée à chaque fois qu'un usager change de ménage, ou qu'un ménage change d'adresse. Il est donc possible de retrouver l'historique complet des adresses pour un usager donné via cette table.
|
||||
- la vue :code:`view_chill_person_current_address` reprend l'adresse actuelle des usagers.
|
||||
|
||||
Adresses et unités géographiques
|
||||
--------------------------------
|
||||
|
||||
Chill propose des statistiques sur la localisation des adresses par rapport à des zones géographiques (:code:`chill_main_geographical_unit`).
|
||||
|
||||
Comme la résolution géographique des adresses est coûteuse en CPU et en temps de traitement, une vue matérialisée a été créée: :code:`view_chill_main_address_geographical_unit`. Elle est rafraichie quotidiennement dans la base de donnée de production.
|
||||
|
||||
Liste des tables et commentaires
|
||||
================================
|
||||
|
||||
Une liste commentée de toutes les tables :download:`est disponible au format CSV <./database/table_list.csv`.
|
||||
@@ -1,17 +1,30 @@
|
||||
# Embeddable comments
|
||||
|
||||
.. Copyright (C) 2016 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".
|
||||
|
||||
|
||||
Embeddable comments
|
||||
###################
|
||||
|
||||
Those embeddable comments is a comment with some metadata:
|
||||
|
||||
* the one who updated the comment (the comment itself, and not the whole entity);
|
||||
* the date and time for the last update (again, the comment itself, and not the whole entity).
|
||||
|
||||
We make usage of [embeddable ](https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/tutorials/embeddables.html).
|
||||
We make usage of `embeddables <https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/tutorials/embeddables.html>`_.
|
||||
|
||||
## Embed the comment
|
||||
Embed the comment
|
||||
=================
|
||||
|
||||
The comment may be embedded into the entity:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
@@ -38,6 +51,7 @@ The comment may be embedded into the entity:
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
@@ -54,21 +68,27 @@ The comment may be embedded into the entity:
|
||||
$this->comment = $comment;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Note on relation to :class:`User`
|
||||
Note on relation to :class:`User`
|
||||
=================================
|
||||
|
||||
The embeddable proposed by Doctrine does not support relationship to other entities. The entity Comment is able to render a user's id, but not an User object.
|
||||
|
||||
`$activity->getComment()->getUserId(); // return user id of the last author`
|
||||
|
||||
`$activity->getComment()->getUser(); // does not work !`
|
||||
.. code-block:: php
|
||||
|
||||
## Usage into form
|
||||
$activity->getComment()->getUserId(); // return user id of the last author
|
||||
|
||||
Use the `Chill\MainBundle\Form\Type\CommentType` to load the form widget:
|
||||
$activity->getComment()->getUser(); // does not work !
|
||||
|
||||
|
||||
Usage into form
|
||||
===============
|
||||
|
||||
Use the :class:`Chill\MainBundle\Form\Type\CommentType` to load the form widget:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
namespace Chill\ActivityBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
@@ -90,8 +110,12 @@ Use the `Chill\MainBundle\Form\Type\CommentType` to load the form widget:
|
||||
;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Render the comment
|
||||
Render the comment
|
||||
==================
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ activity.comment|chill_entity_render_box }}
|
||||
|
||||
|
||||
`{{ activity.comment|chill_entity_render_box }}`
|
||||
@@ -1,4 +1,16 @@
|
||||
# Stats about event on entity in php world
|
||||
|
||||
.. 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".
|
||||
|
||||
.. _entity-info:
|
||||
|
||||
Stats about event on entity in php world
|
||||
########################################
|
||||
|
||||
It is necessary to be able to gather information about events for some entities:
|
||||
|
||||
@@ -6,9 +18,11 @@ It is necessary to be able to gather information about events for some entities:
|
||||
- who did it;
|
||||
- ...
|
||||
|
||||
Those "infos" are not linked with right management, like describe in [timelines`.
|
||||
Those "infos" are not linked with right management, like describe in :ref:`timelines`.
|
||||
|
||||
### “infos” for some stats and info about an entity
|
||||
|
||||
“infos” for some stats and info about an entity
|
||||
-----------------------------------------------
|
||||
|
||||
Building an info means:
|
||||
|
||||
@@ -18,10 +32,10 @@ Building an info means:
|
||||
A framework api is built to be able to build multiple “infos” entities
|
||||
through “union” views:
|
||||
|
||||
- use a command ``bin/console chill:db:sync-views`` to synchronize view (create view if it does not exist, or update
|
||||
- use a command ``bin/console chill:db:sync-views`` to synchronize view (create view if it does not exists, or update
|
||||
views when new SQL parts are added in the UNION query. Internally, this command call a new ``ViewEntityInfoManager``,
|
||||
which iterate over available views to build the SQL;
|
||||
- one can create new “view entity info” by implementing a
|
||||
- one can create a new “view entity info” by implementing a
|
||||
``ViewEntityInfoProviderInterface``
|
||||
- this implementation of the interface is free to create another
|
||||
interface for building each part of the UNION query. This interface
|
||||
@@ -31,13 +45,14 @@ through “union” views:
|
||||
So, converting new “events” into rows for ``AccompanyingPeriodInfo`` is
|
||||
just implementing this interface!
|
||||
|
||||
### Implementation for AccompanyingPeriod (``AccompanyingPeriod/AccompanyingPeriodInfo``)
|
||||
Implementation for AccompanyingPeriod (``AccompanyingPeriod/AccompanyingPeriodInfo``)
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
A class is created for computing some statistical info for an
|
||||
AccompanyingPeriod: ``AccompanyingPeriod/AccompanyingPeriodInfo``. This
|
||||
contains information about “something happens”, who did it and when.
|
||||
|
||||
Having that info in the table answers some questions like:
|
||||
Having those info in table answer some questions like:
|
||||
|
||||
- when is the last and the first action (AccompanyingPeriodWork,
|
||||
Activity, AccompanyingPeriodWorkEvaluation, …) on the period;
|
||||
@@ -45,43 +60,46 @@ Having that info in the table answers some questions like:
|
||||
user.
|
||||
|
||||
The AccompanyingPeriod info is mapped to a SQL view, not a table. The
|
||||
SQL view is built dynamically (see below), and gathers info from
|
||||
sql view is built dynamically (see below), and gather infos from
|
||||
ActivityBundle, PersonBundle, CalendarBundle, … It is possible to create
|
||||
a custom bundle and add info on this view.
|
||||
custom bundle and add info on this view.
|
||||
|
||||
.. code:: php
|
||||
|
||||
```php
|
||||
/**
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="view_chill_person_accompanying_period_info") ](==== THIS IS A VIEW, NOT A TABLE
|
||||
* @ORM\Table(name="view_chill_person_accompanying_period_info") <==== THIS IS A VIEW, NOT A TABLE
|
||||
*/
|
||||
class AccompanyingPeriodInfo
|
||||
{
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
#### Why do we need this?
|
||||
Why do we need this ?
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For multiple jobs in a PHP world:
|
||||
For multiple jobs in PHP world:
|
||||
|
||||
- moving the accompanying period to another step when inactive,
|
||||
- moving the accompanying period to another steps when inactive,
|
||||
automatically;
|
||||
- listing all the users which are intervening on the action on a new
|
||||
“Liste des intervenants” page;
|
||||
- filtering on exports
|
||||
|
||||
Later we will launch automatic anonymize for an accompanying period and
|
||||
Later, we will launch automatic anonymise for accompanying period and
|
||||
all related entities through this information.
|
||||
|
||||
#### How are the SQL views built that are mapped to “info” entities?
|
||||
How is built the SQL views which is mapped to “info” entities ?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The AccompanyingPeriodInfo entity is mapped by a SQL view (not a regular
|
||||
table).
|
||||
|
||||
The SQL view is built dynamically; it is a SQL view like this, for now (April 2023):
|
||||
The sql view is built dynamically, it is a SQL view like this, for now (April 2023):
|
||||
|
||||
.. code:: sql
|
||||
|
||||
```sql
|
||||
create view view_chill_person_accompanying_period_info
|
||||
(accompanyingperiod_id, relatedentity, relatedentityid, user_id, infodate, discriminator, metadata) as
|
||||
SELECT w.accompanyingperiod_id,
|
||||
@@ -173,14 +191,13 @@ The SQL view is built dynamically; it is a SQL view like this, for now (April 20
|
||||
FROM activity
|
||||
LEFT JOIN activity_user au ON activity.id = au.activity_id
|
||||
WHERE activity.accompanyingperiod_id IS NOT NULL;
|
||||
```
|
||||
|
||||
As you can see, the view gathers multiple SELECT queries and binds them
|
||||
As you can see, the view gather multiple SELECT queries and bind them
|
||||
with UNION.
|
||||
|
||||
Each SELECT query is built dynamically, through a class implementing an
|
||||
interface: ``Chill\PersonBundle\Service\EntityInfo\AccompanyingPeriodInfoUnionQueryPartInterface``, `like
|
||||
here <https://gitlab.com/Chill-Projet/chill-bundles/-/blob/master/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodInfoQueryPart/AccompanyingPeriodWorkEndQueryPartForAccompanyingPeriodInfo.php.md)__
|
||||
here <https://gitlab.com/Chill-Projet/chill-bundles/-/blob/master/src/Bundle/ChillPersonBundle/Service/EntityInfo/AccompanyingPeriodInfoQueryPart/AccompanyingPeriodWorkEndQueryPartForAccompanyingPeriodInfo.php>`__
|
||||
|
||||
To add new `SELECT` query in different `UNION` parts in the SQL view, create a
|
||||
To add new `SELECT` query in different `UNION` parts in the sql view, create a
|
||||
service and implements this interface: ``Chill\PersonBundle\Service\EntityInfo\AccompanyingPeriodInfoUnionQueryPartInterface``.
|
||||
@@ -1,10 +1,12 @@
|
||||
## ESLint
|
||||
ESLint
|
||||
======
|
||||
|
||||
To improve the quality of our JS and VueJS code, ESLint and eslint-plugin-vue are implemented within the chill-bundles project.
|
||||
|
||||
### Commands
|
||||
Commands
|
||||
--------
|
||||
|
||||
To run ESLint, you can simply use the [`eslint`` command within the chill-bundles directory.
|
||||
To run ESLint, you can simply use the ``eslint`` command within the chill-bundles directory.
|
||||
This runs eslint **not** taking the baseline into account, thus showing all existing errors in the project.
|
||||
|
||||
A script was also added to package.json allowing you to execute ``yarn run eslint``.
|
||||
@@ -17,18 +19,20 @@ Interesting options that can be used in combination with eslint are:
|
||||
- ``--quiet`` to only get errors and silence the warnings
|
||||
- ``--fix`` to have ESLint fix what it can, automatically. This will not fix everything.
|
||||
|
||||
### Baseline
|
||||
Baseline
|
||||
--------
|
||||
|
||||
To allow us the time to fix linting errors/warnings, a baseline has been created using the following command
|
||||
To allow us the time to fix linting errors/warnings a baseline has been created using the following command
|
||||
- ``npx eslint-baseline "**/*.{js,vue}"``
|
||||
|
||||
The baseline has been committed and the gitlab CI setup to only fail upon new errors/warnings being created.
|
||||
The baseline has been commited and the gitlab CI setup to only fail upon new errors/warnings being created.
|
||||
When fixing errors/warnings manually, please update the baseline.
|
||||
|
||||
1. Delete the current baseline file
|
||||
2. Run the above command locally, this will automatically create a new baseline that should be commited
|
||||
|
||||
### Rules
|
||||
Rules
|
||||
-----
|
||||
|
||||
We use Vue 3, so the rules can be configured as follows within the ``eslint.config.mjs`` file:
|
||||
|
||||
@@ -41,14 +45,17 @@ Configurations for using Vue.js 3.x:
|
||||
- ``.configs["flat/recommended"]`` ... Above, plus rules to enforce subjective community defaults to ensure consistency.
|
||||
|
||||
Detailed information about which rules each set includes can be found here:
|
||||
`https://eslint.vuejs.org/rules/ ](https://eslint.vuejs.org/rules/)
|
||||
`https://eslint.vuejs.org/rules/ <https://eslint.vuejs.org/rules/>`_
|
||||
|
||||
### Manual Rule Configuration
|
||||
Manual Rule Configuration
|
||||
-------------------------
|
||||
|
||||
We can also manually configure certain rules or override rules that are part of the ruleset specified above.
|
||||
|
||||
For example, if we want to turn off a certain rule, we can do so as follows:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
rules: {
|
||||
'vue/multi-word-component': 'off'
|
||||
}
|
||||
@@ -57,6 +64,8 @@ We could also change the severity of a certain rule from 'error' to 'warning', f
|
||||
|
||||
Within specific ``.js`` or ``.vue`` files, we can also override a certain rule only for that specific file by adding a comment:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
/* eslint multi-word-component: "off", no-child-content: "error"
|
||||
--------
|
||||
Here's a description about why this configuration is necessary. */
|
||||
84
docs/source/development/export-sequence.puml
Normal file
84
docs/source/development/export-sequence.puml
Normal file
@@ -0,0 +1,84 @@
|
||||
@startuml
|
||||
'https://plantuml.com/sequence-diagram
|
||||
|
||||
autonumber
|
||||
|
||||
User -> ExportController: configure export using form
|
||||
activate ExportController
|
||||
ExportController -> ExportForm: build form
|
||||
activate ExportForm
|
||||
|
||||
loop for every ExportElement (Filter, Aggregator)
|
||||
ExportForm -> ExportElement: `buildForm`
|
||||
activate ExportElement
|
||||
ExportElement -> ExportForm: add form to builders
|
||||
deactivate ExportElement
|
||||
end
|
||||
|
||||
ExportForm -> ExportController
|
||||
deactivate ExportForm
|
||||
|
||||
ExportController -> User: show form
|
||||
deactivate ExportController
|
||||
|
||||
note left of User: Configure the export:\ncheck filters, aggregators, …
|
||||
|
||||
User -> ExportController: post configuration of the export
|
||||
activate ExportController
|
||||
|
||||
ExportController -> ExportForm: `getData`
|
||||
activate ExportForm
|
||||
ExportForm -> ExportController: return data: list of entities, etc.
|
||||
deactivate ExportForm
|
||||
|
||||
loop for every ExportElement (Filter, Aggregator)
|
||||
ExportController -> ExportElement: serializeData (data)
|
||||
activate ExportElement
|
||||
ExportElement -> ExportController: return serializedData (simple array with string, int, …)
|
||||
deactivate ExportElement
|
||||
end
|
||||
|
||||
ExportController -> Database: `INSERT INTO RequestGeneration_table` (insert new entity)
|
||||
ExportController -> MessageQueue: warn about a new request
|
||||
activate MessageQueue
|
||||
ExportController -> User: "ok, generation is in process"
|
||||
deactivate ExportController
|
||||
|
||||
note left of User: The user see a waiting screen
|
||||
|
||||
MessageQueue -> MessengerConsumer: forward the message to the MessengerConsumer
|
||||
deactivate MessageQueue
|
||||
activate MessengerConsumer
|
||||
MessengerConsumer -> Database: `SELECT * FROM RequestGeneration_table WHERE id = %s`
|
||||
activate Database
|
||||
Database -> MessengerConsumer: return RequestGeneration with serializedData
|
||||
deactivate Database
|
||||
|
||||
loop for every ExportElement (Filter, Aggregator)
|
||||
MessengerConsumer -> ExportElement: deserializeData
|
||||
activate ExportElement
|
||||
ExportElement -> MessengerConsumer: return data (list of entities, etc.) from the serialized array
|
||||
deactivate ExportElement
|
||||
MessengerConsumer -> ExportElement: alter the sql query (`ExportElement::alterQuery`)
|
||||
activate ExportElement
|
||||
ExportElement -> MessengerConsumer: return the query with WHERE and GROUP BY clauses
|
||||
deactivate ExportElement
|
||||
end
|
||||
|
||||
MessengerConsumer -> MessengerConsumer: prepare the export
|
||||
MessengerConsumer -> MessengerConsumer: save the export as a stored object
|
||||
MessengerConsumer -> Database: `UPDATE RequestGeneration_table SET ready = true`
|
||||
deactivate MessengerConsumer
|
||||
|
||||
User -> ExportController: pull every 5s to know if the export is generated
|
||||
activate ExportController
|
||||
ExportController -> User: warn the export is generated
|
||||
deactivate ExportController
|
||||
|
||||
User -> ExportController: download the export from object storage
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@enduml
|
||||
@@ -1,49 +1,66 @@
|
||||
###### Exports
|
||||
.. 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".
|
||||
|
||||
|
||||
Exports
|
||||
*******
|
||||
|
||||
Export is an important issue within the Chill software : users should be able to :
|
||||
|
||||
- compute statistics about their activity ;
|
||||
- list "things" which are a part of their activities.
|
||||
|
||||
The [main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles.
|
||||
The `main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
`The issue where this framework was [discussed](https://git.framasoft.org/Chill-project/Chill-Main/issues/9)
|
||||
.. seealso::
|
||||
|
||||
`The issue where this framework was discussed <https://git.framasoft.org/Chill-project/Chill-Main/issues/9>`_
|
||||
Provides some information about the pursued features and architecture.
|
||||
|
||||
## Concepts
|
||||
Concepts
|
||||
========
|
||||
|
||||
### Some vocabulary: 3 "Export elements"
|
||||
|
||||
Some vocabulary: 3 "Export elements"
|
||||
------------------------------------
|
||||
|
||||
Four terms are used for this framework :
|
||||
|
||||
Exports
|
||||
provide some basic operation on the data. Two kinds of exports are available :
|
||||
|
||||
- computed data: it may be "the number of people," "the number of activities," "the duration of activities," ...
|
||||
- list data: it may be "the list of people," "the list of activities," ...
|
||||
- computed data : it may be "the number of people", "the number of activities", "the duration of activities", ...
|
||||
- list data : it may be "the list of people", "the list of activities", ...
|
||||
|
||||
Filters
|
||||
The filters create a filter on the data: it removes some information the user doesn't want to introduce in the computation done by the export.
|
||||
|
||||
Example of a filter: "people under 18-year-olds," "activities between the 1st of June and the 31st December," ...
|
||||
Example of a filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ...
|
||||
|
||||
Aggregators
|
||||
The aggregator aggregates the data into some group (some software use the term 'bucket').
|
||||
|
||||
Example of an aggregator: "group people by gender," "group people by nationality," "group activity by type," ...
|
||||
Example of an aggregator : "group people by gender", "group people by nationality", "group activity by type", ...
|
||||
|
||||
Formatters
|
||||
The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client.
|
||||
|
||||
Example of a formatter: "format data as CSV", "format data as an ods spreadsheet," ...
|
||||
Example of a formatter: "format data as CSV", "format data as an ods spreadsheet", ...
|
||||
|
||||
### Anatomy of an export
|
||||
Anatomy of an export
|
||||
---------------------
|
||||
|
||||
An export can be thought of as a sentence where each part of this sentence refers to one or multiple export elements. Examples :
|
||||
|
||||
**Example 1**: Count the number of people having at least one activity in the last month 12, and group them by nationality and gender, and format them in a CSV spreadsheet.
|
||||
**Example 1**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender, and format them in a CSV spreadsheet.
|
||||
|
||||
Here :
|
||||
|
||||
@@ -56,16 +73,21 @@ Here :
|
||||
Note that :
|
||||
|
||||
- Aggregators, filters, exports and formatters are cross-bundle. Here the bundle *activity* provides a filter which is applied on an export provided by the person bundle ;
|
||||
- Multiple aggregators or filters for one export may exist. Currently, only one export is allowed.
|
||||
- Multiple aggregator or filter for one export may exist. Currently, only one export is allowed.
|
||||
|
||||
The result might be :
|
||||
|
||||
+-------------+--------+------------------+
|
||||
| Nationality | Gender | Number of people |
|
||||
| Russian | Male | 12 |
|
||||
| Russian | Female | 24 |
|
||||
| France | Male | 110 |
|
||||
| France | Female| 150 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| Nationality | Gender | Number of people |
|
||||
+=======================+================+===========================+
|
||||
| Russian | Male | 12 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| Russian | Female | 24 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| France | Male | 110 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
| France | Female | 150 |
|
||||
+-----------------------+----------------+---------------------------+
|
||||
|
||||
**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in an OpenDocument spreadsheet.
|
||||
|
||||
@@ -81,97 +103,122 @@ The result might be :
|
||||
|
||||
+-----------------------+----------------------+
|
||||
| Week | Number of activities |
|
||||
+=======================+======================+
|
||||
| 2015-10 | 10 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-11 | 12 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-12 | 10 |
|
||||
+-----------------------+----------------------+
|
||||
| 2015-13 | 9 |
|
||||
+-----------------------+----------------------+
|
||||
|
||||
### Authorization and exports
|
||||
Authorization and exports
|
||||
-------------------------
|
||||
|
||||
Exports, filters, and aggregators should not show data the user is not allowed to see within the application.
|
||||
Exports, filters and aggregators should not show data the user is not allowed to see within the application.
|
||||
|
||||
In other words, developers are required to take care of user authorization for each export.
|
||||
|
||||
There should be a specific role that grants permission to users who are allowed to build exports. For more simplicity, this role should apply on a center, and should not require special circles.
|
||||
|
||||
## How does the magic work?
|
||||
How does the magic work ?
|
||||
===========================
|
||||
|
||||
To build an export, we rely on the capacity of the database to execute queries with aggregate (i.e. GROUP BY) and filter (i.e. WHERE) instructions.
|
||||
|
||||
An export is an SQL query that is initiated by an export and modified by aggregators and filters.
|
||||
An export is an SQL query which is initiated by an export, and modified by aggregators and filters.
|
||||
|
||||
**Example**: Count the number of people having at least one activity in the last month 12, and group them by nationality and gender
|
||||
.. note::
|
||||
|
||||
**Example**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender
|
||||
|
||||
1. The report initiates the query
|
||||
|
||||
```SQL
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
```
|
||||
|
||||
2. The filter adds a where and join clause :
|
||||
|
||||
```SQL
|
||||
.. code-block:: SQL
|
||||
|
||||
SELECT count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
```
|
||||
|
||||
3. The aggregator "nationality" adds a GROUP BY clause and a column in the SELECT statement:
|
||||
|
||||
```sql
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, count(people.*) FROM people
|
||||
RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality
|
||||
```
|
||||
|
||||
4. The aggregator "gender" does the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement :
|
||||
|
||||
```sql
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT people.nationality, people.gender, count(people.*)
|
||||
FROM people RIGHT JOIN activity
|
||||
WHERE activity.date IS BETWEEN now AND 6 month ago
|
||||
GROUP BY nationality, gender
|
||||
```
|
||||
|
||||
Each filter, aggregator, and filter may collect parameters from the user through a form. This form is appended to the export form. Here is an example.
|
||||
Each filter, aggregator and filter may collect parameters from the user through a form. This form is appended to the export form. Here is an example.
|
||||
|
||||
.. figure:: /_static/screenshots/development/export_form-fullpage.png
|
||||
|
||||
The screenshot shows the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which triggers a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other unchecked filter does not show the subform.
|
||||
|
||||
Two aggregators are also checked: by Country of birth (*Aggréger les personnes par pays de naissance*, the corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also triggers a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
|
||||
Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, the corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also triggers a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform.
|
||||
|
||||
### The Export Manager
|
||||
The Export Manager
|
||||
------------------
|
||||
|
||||
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which registers all exports, aggregators, filters, and formatters.
|
||||
The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which registers all exports, aggregators, filters and formatters.
|
||||
|
||||
The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` for each export request.
|
||||
|
||||
### The export form step
|
||||
|
||||
The export form step
|
||||
--------------------
|
||||
|
||||
The form step allows you to build a form, combining different parts of the module.
|
||||
|
||||
The building of forms is split into different subforms, where each one is responsible for rendering their part of the form (aggregators, filters, and export).
|
||||
|
||||
.. figure:: /_static/puml/exports/form_steps.png
|
||||
:scale: 40%
|
||||
|
||||
### The formatter form step
|
||||
The formatter form step
|
||||
-----------------------
|
||||
|
||||
The formatter form is processed *after* the user filled the export form. It is built the same way, but receives the data entered by the user on the previous step as parameters (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators).
|
||||
|
||||
### Processing the export
|
||||
Processing the export
|
||||
---------------------
|
||||
|
||||
This schema can explain the export process :
|
||||
The export process can be explained by this schema :
|
||||
|
||||
.. figure:: /_static/puml/exports/processing_export.png
|
||||
:scale: 40%
|
||||
|
||||
(Click to enlarge)
|
||||
|
||||
## Export, formatters, and filters explained
|
||||
|
||||
### Exports
|
||||
Export, formatters and filters explained
|
||||
========================================
|
||||
|
||||
Exports
|
||||
-------
|
||||
|
||||
This is an example of the ``CountPerson`` export :
|
||||
|
||||
.. literalinclude:: /_static/code/exports/CountPerson.php
|
||||
:language: php
|
||||
:linenos:
|
||||
|
||||
* **Line 36**: the ``getType`` function returns a string. This string will be used to find the aggregtors and filters which will apply to this export.
|
||||
* **Line 41**: a simple description to help users understand what your export does.
|
||||
* **Line 46**: The title of the export. A summary of what your export does.
|
||||
@@ -179,17 +226,26 @@ This is an example of the ``CountPerson`` export :
|
||||
* **Line 56**: We initiate the query here...
|
||||
* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` objects in one array
|
||||
* **Line 63**: We create the query with a query builder.
|
||||
* **Line 74**: We return the result but make sure to hydrate the results as an array.
|
||||
* **Line 74**: We return the result, but make sure to hydrate the results as an array.
|
||||
* **Line 103**: return the list of formatter types which are allowed to be applied on this filter
|
||||
|
||||
### Filters
|
||||
Filters
|
||||
-------
|
||||
|
||||
This is an example of the *filter by birthdate*. This filter asks some information through a form (`buildForm` is not empty), and this form must be validated. To perform this validation, we implement a new Interface: `Chill\MainBundle\Export\ExportElementValidatedInterface`:
|
||||
This is an example of the *filter by birthdate*. This filter asks some information through a form (`buildForm` is not empty), and this form must be validated. To perform this validation, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`:
|
||||
|
||||
.. literalinclude:: /_static/code/exports/BirthdateFilter.php
|
||||
:language: php
|
||||
|
||||
.. todo::
|
||||
|
||||
Continue to explain the export framework
|
||||
|
||||
With many-to-* relationship, why should we set WHERE clauses in an EXISTS subquery instead of a JOIN?
|
||||
-----------------------------------------------------------------------------------------------------
|
||||
.. _main bundle: https://git.framasoft.org/Chill-project/Chill-Main
|
||||
|
||||
|
||||
With many-to-* relationship, why should we set WHERE clauses in an EXISTS subquery instead of a JOIN ?
|
||||
``````````````````````````````````````````````````````````````````````````````````````````````````````
|
||||
|
||||
As we described above, the doctrine builder is converted into a sql query. Let's see how to compute the "number of course
|
||||
which count at least one activity type with the id 7". For the purpose of this demonstration, we will restrict this on
|
||||
@@ -197,65 +253,79 @@ two accompanying period only: the ones with id 329 and 334.
|
||||
|
||||
Let's see the list of activities associated with those accompanying period:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT id, accompanyingperiod_id, type_id FROM activity WHERE accompanyingperiod_id IN (329, 334) AND type_id = 7
|
||||
ORDER BY accompanyingperiod_id;
|
||||
|
||||
We see that we have 6 activities for the accompanying period with id 329, and only one for the 334's one.
|
||||
|
||||
| id | accompanyingperiod_id | type_id |
|
||||
|------|----------------------|---------|
|
||||
| 990 | 329 | 7 |
|
||||
| 986 | 329 | 7 |
|
||||
| 987 | 329 | 7 |
|
||||
| 993 | 329 | 7 |
|
||||
| 991 | 329 | 7 |
|
||||
| 992 | 329 | 7 |
|
||||
| 1000 | 334 | 7 |
|
||||
.. csv-table::
|
||||
:header: id, accompanyingperiod_id, type_id
|
||||
|
||||
990,329,7
|
||||
986,329,7
|
||||
987,329,7
|
||||
993,329,7
|
||||
991,329,7
|
||||
992,329,7
|
||||
1000,334,7
|
||||
|
||||
Let's calculate the average duration for those accompanying periods, and the number of period:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT AVG(age(COALESCE(closingdate, CURRENT_DATE), openingdate)), COUNT(id) from chill_person_accompanying_period WHERE id IN (329, 334);
|
||||
|
||||
The result of this query is:
|
||||
|
||||
| AVG | COUNT |
|
||||
|--------------------------------------------------|-------|
|
||||
| 2 years 2 mons 21 days 12 hours 0 mins 0.0 secs | 2 |
|
||||
.. csv-table::
|
||||
:header: AVG, COUNT
|
||||
|
||||
Now, we count the number of accompanying period, adding a `JOIN` clause which make a link to the `activity` table, and add a `WHERE` clause to keep
|
||||
2 years 2 mons 21 days 12 hours 0 mins 0.0 secs,2
|
||||
|
||||
Now, we count the number of accompanying period, adding a :code:`JOIN` clause which make a link to the :code:`activity` table, and add a :code:`WHERE` clause to keep
|
||||
only the accompanying period which contains the given activity type:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT COUNT(chill_person_accompanying_period.id) from chill_person_accompanying_period
|
||||
JOIN activity ON chill_person_accompanying_period.id = activity.accompanyingperiod_id
|
||||
WHERE chill_person_accompanying_period.id IN (329, 334) AND activity.type_id = 7;
|
||||
|
||||
What are the results here?
|
||||
What are the results here ?
|
||||
|
||||
| COUNT |
|
||||
|-------|
|
||||
| 7 |
|
||||
.. csv-table::
|
||||
:header: COUNT
|
||||
|
||||
`7` ! Why this result? Because the number of lines is duplicated for each activity. Let's see the list of rows which
|
||||
7
|
||||
|
||||
:code:`7` ! Why this result ? Because the number of lines is duplicated for each activity. Let's see the list of rows which
|
||||
are taken into account for the computation:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT chill_person_accompanying_period.id, activity.id from chill_person_accompanying_period
|
||||
JOIN activity ON chill_person_accompanying_period.id = activity.accompanyingperiod_id
|
||||
WHERE chill_person_accompanying_period.id IN (329, 334) AND activity.type_id = 7;
|
||||
|
||||
| accompanyingperiod.id | activity.id |
|
||||
|----------------------|-------------|
|
||||
| 329 | 993 |
|
||||
| 334 | 1000 |
|
||||
| 329 | 987 |
|
||||
| 329 | 990 |
|
||||
| 329 | 991 |
|
||||
| 329 | 992 |
|
||||
| 329 | 986 |
|
||||
.. csv-table::
|
||||
:header: accompanyingperiod.id, activity.id
|
||||
|
||||
For each activity, a row is created and, as we count the number of non-null `accompanyingperiod.id` columns, we
|
||||
329,993
|
||||
334,1000
|
||||
329,987
|
||||
329,990
|
||||
329,991
|
||||
329,992
|
||||
329,986
|
||||
|
||||
For each activity, a row is created and, as we count the number of non-null :code:`accompanyingperiod.id` columns, we
|
||||
count one entry for each activity (actually, we count the number of activities).
|
||||
|
||||
So, let's use the `DISTINCT` keyword to count only once the equal ids:
|
||||
So, let's use the :code:`DISTINCT` keyword to count only once the equal ids:
|
||||
|
||||
.. code-block::
|
||||
|
||||
SELECT COUNT(DISTINCT chill_person_accompanying_period.id) from chill_person_accompanying_period
|
||||
JOIN activity ON chill_person_accompanying_period.id = activity.accompanyingperiod_id
|
||||
@@ -263,31 +333,38 @@ So, let's use the `DISTINCT` keyword to count only once the equal ids:
|
||||
|
||||
Now, it works again...
|
||||
|
||||
| COUNT |
|
||||
|-------|
|
||||
| 2 |
|
||||
.. csv-table::
|
||||
:header: COUNT
|
||||
|
||||
But, for the average duration, this won't work: the duration which are equals (because the `openingdate` is the same and
|
||||
`closingdate` is still `NULL`, for instance) will be counted only once, which will give unexpected result.
|
||||
2
|
||||
|
||||
The solution is to move the condition "having an activity with activity type with id 7" in a `EXISTS` clause:
|
||||
But, for the average duration, this won't work: the duration which are equals (because the :code:`openingdate` is the same and
|
||||
:code:`closingdate` is still :code:`NULL`, for instance) will be counted only once, which will give unexpected result.
|
||||
|
||||
The solution is to move the condition "having an activity with activity type with id 7" in a :code:`EXISTS` clause:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT COUNT(chill_person_accompanying_period.id) from chill_person_accompanying_period
|
||||
WHERE chill_person_accompanying_period.id IN (329, 334) AND EXISTS (SELECT 1 FROM activity WHERE type_id = 7 AND accompanyingperiod_id = chill_person_accompanying_period.id);
|
||||
|
||||
The result is correct without `DISTINCT` keyword:
|
||||
The result is correct without :code:`DISTINCT` keyword:
|
||||
|
||||
| COUNT |
|
||||
|-------|
|
||||
| 2 |
|
||||
.. csv-table::
|
||||
:header: COUNT
|
||||
|
||||
2
|
||||
|
||||
And we can now compute the average duration without fear:
|
||||
|
||||
.. code-block:: sql
|
||||
|
||||
SELECT AVG(age(COALESCE(closingdate, CURRENT_DATE), openingdate)) from chill_person_accompanying_period
|
||||
WHERE chill_person_accompanying_period.id IN (329, 334) AND EXISTS (SELECT 1 FROM activity WHERE type_id = 7 AND accompanyingperiod_id = chill_person_accompanying_period.id);
|
||||
|
||||
Give the result:
|
||||
|
||||
| AVG |
|
||||
|--------------------------------------------------|
|
||||
| 2 years 2 mons 21 days 12 hours 0 mins 0.0 secs |
|
||||
.. csv-table::
|
||||
:header: AVG
|
||||
|
||||
2 years 2 mons 21 days 12 hours 0 mins 0.0 secs
|
||||
@@ -1,25 +0,0 @@
|
||||
# Forms and form types
|
||||
|
||||
###### Date picker
|
||||
|
||||
Class
|
||||
`Chill\MainBundle\Form\Type\ChillDateType`
|
||||
Extend
|
||||
`Symfony\Component\Form\Extension\Core\Type\DateType`
|
||||
|
||||
Usage :
|
||||
|
||||
```
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
|
||||
$builder->add('date' ChillDateType::class);
|
||||
```
|
||||
|
||||
###### Text editor
|
||||
|
||||
Add a text editor (by default).
|
||||
|
||||
Class
|
||||
`Chill\MainBundle\Form\Type\ChillTextareaType`
|
||||
Options
|
||||
* `disable_editor` to disable text editor
|
||||
42
docs/source/development/forms.rst
Normal file
42
docs/source/development/forms.rst
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
.. 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".
|
||||
|
||||
.. _forms:
|
||||
|
||||
Forms and form types
|
||||
####################
|
||||
|
||||
Date picker
|
||||
***********
|
||||
|
||||
Class
|
||||
:class:`Chill\MainBundle\Form\Type\ChillDateType`
|
||||
Extend
|
||||
:class:`Symfony\Component\Form\Extension\Core\Type\DateType`
|
||||
|
||||
|
||||
Usage :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
|
||||
$builder->add('date' ChillDateType::class);
|
||||
|
||||
Text editor
|
||||
***********
|
||||
|
||||
Add a text editor (by default).
|
||||
|
||||
Class
|
||||
:class:`Chill\MainBundle\Form\Type\ChillTextareaType`
|
||||
Options
|
||||
* :code:`disable_editor` to disable text editor
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Development
|
||||
|
||||
As Chill relies on the [symfony ](http://symfony.com) framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and help with things we've encountered.
|
||||
|
||||
- [Instructions to create a new bundle](create-a-new-bundle.md)
|
||||
- [CRUD (Create - Update - Delete) for one entity](crud.md)
|
||||
- [Helpers for building a REST API](api.md)
|
||||
- [Routing](routing.md)
|
||||
- [Menus](menus.md)
|
||||
- [Forms](forms.md)
|
||||
- [Access control model](access_control_model.md)
|
||||
- [Messages to users](messages-to-users.md)
|
||||
- [Pagination](pagination.md)
|
||||
- [Localisation](localisation.md)
|
||||
- [Logging](logging.md)
|
||||
- [Database migrations](migrations.md)
|
||||
- [Searching](searching.md)
|
||||
- [Timelines](timelines.md)
|
||||
- [Exports](exports.md)
|
||||
- [Embeddable comments](embeddable-comments.md)
|
||||
- [Run tests](run-tests.md)
|
||||
- [ESLint](es-lint.md)
|
||||
- [Useful snippets](useful-snippets.md)
|
||||
- [Manual](manual/index.md)
|
||||
- [Assets](assets.md)
|
||||
- [Cron Jobs](cronjob.md)
|
||||
- [Info about entities](entity-info.md)
|
||||
- [Info about database (in French)](database-principles.md)
|
||||
- [Developer FAQ](FAQ.md)
|
||||
|
||||
###### Layout and UI
|
||||
|
||||
- [Render entities automatically](render-entity.md)
|
||||
- [Layout / Template usage](user-interface/layout-template-usage.md)
|
||||
- [Classes and mixins](user-interface/css-classes.md)
|
||||
- [Widgets](user-interface/widgets.md)
|
||||
- [Javascript function](user-interface/js-functions.md)
|
||||
|
||||
###### Help, I am lost!
|
||||
|
||||
Write an email at info@champs-libres.coop, and we will help you!
|
||||
59
docs/source/development/index.rst
Normal file
59
docs/source/development/index.rst
Normal file
@@ -0,0 +1,59 @@
|
||||
.. 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".
|
||||
|
||||
Development
|
||||
###########
|
||||
|
||||
As Chill relies on the `symfony <http://symfony.com>`_ framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and help with things we've encountered.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Instructions to create a new bundle <create-a-new-bundle.rst>
|
||||
CRUD (Create - Update - Delete) for one entity <crud.rst>
|
||||
Helpers for building a REST API <api.rst>
|
||||
Routing <routing.rst>
|
||||
Menus <menus.rst>
|
||||
Forms <forms.rst>
|
||||
Access control model <access_control_model.rst>
|
||||
Messages to users <messages-to-users.rst>
|
||||
Pagination <pagination.rst>
|
||||
Localisation <localisation.rst>
|
||||
Logging <logging.rst>
|
||||
Database migrations <migrations.rst>
|
||||
Searching <searching.rst>
|
||||
Timelines <timelines.rst>
|
||||
Exports <exports.rst>
|
||||
Embeddable comments <embeddable-comments.rst>
|
||||
Run tests <run-tests.rst>
|
||||
ESLint <es-lint.rst>
|
||||
Useful snippets <useful-snippets.rst>
|
||||
manual/index.rst
|
||||
Assets <assets.rst>
|
||||
Cron Jobs <cronjob.rst>
|
||||
Info about entities <entity-info.rst>
|
||||
Info about database (in French) <database-principles.rst>
|
||||
Developer FAQ <FAQ.rst>
|
||||
|
||||
Layout and UI
|
||||
**************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Render entities automatically <render-entity.rst>
|
||||
Layout / Template usage <user-interface/layout-template-usage.rst>
|
||||
Classes and mixins <user-interface/css-classes.rst>
|
||||
Widgets <user-interface/widgets.rst>
|
||||
Javascript function <user-interface/js-functions.rst>
|
||||
|
||||
|
||||
Help, I am lost !
|
||||
*****************
|
||||
|
||||
Write an email at info@champs-libres.coop, and we will help you !
|
||||
@@ -1,30 +0,0 @@
|
||||
###### Localisation
|
||||
|
||||
## Language in url
|
||||
|
||||
Language should be present in URL, conventionally as the first argument.
|
||||
|
||||
`/fr/your/url/here`
|
||||
|
||||
This allows users to change from one language to another one on each page, which may be useful in multilanguages teams. If the installation is single-language, the language switcher will not appears.
|
||||
|
||||
This is an example of routing defined in YAML :
|
||||
|
||||
```yaml
|
||||
chill_person_general_edit:
|
||||
pattern: /{_locale}/person/{person_id}/general/edit
|
||||
defaults: {_controller: ChillPersonBundle:Person:edit }
|
||||
```
|
||||
|
||||
## Date and time
|
||||
|
||||
The [Intl extension ](http://twig.sensiolabs.org/doc/extensions/intl.html) is enabled on the Chill application.
|
||||
|
||||
You may format date and time using the [localizeddate` function :
|
||||
|
||||
`date|localizeddate('long', 'none')`
|
||||
|
||||
By default, we prefer using the `long` format for date formatting.
|
||||
|
||||
[Documentation for Intl Extension](http://twig.sensiolabs.org/doc/extensions/intl.html)
|
||||
Read the complete doc for the Intl extension.
|
||||
49
docs/source/development/localisation.rst
Normal file
49
docs/source/development/localisation.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
.. 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".
|
||||
|
||||
Localisation
|
||||
*************
|
||||
|
||||
Language in url
|
||||
===============
|
||||
|
||||
Language should be present in URL, conventionnaly as first argument.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
/fr/your/url/here
|
||||
|
||||
This allow users to change from one language to another one on each page, which may be useful in multilanguages teams. If the installation is single-language, the language switcher will not appears.
|
||||
|
||||
This is an example of routing defined in yaml :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_general_edit:
|
||||
pattern: /{_locale}/person/{person_id}/general/edit
|
||||
defaults: {_controller: ChillPersonBundle:Person:edit }
|
||||
|
||||
|
||||
Date and time
|
||||
==============
|
||||
|
||||
The `Intl extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_ is enabled on the Chill application.
|
||||
|
||||
You may format date and time using the `localizeddate` function :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
date|localizeddate('long', 'none')
|
||||
|
||||
By default, we prefer using the `long` format for date formatting.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Documentation for Intl Extension <http://twig.sensiolabs.org/doc/extensions/intl.html>`_
|
||||
Read the complete doc for the Intl extension.
|
||||
|
||||
@@ -1,41 +1,50 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
.. Copyright (C) 2016 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".
|
||||
|
||||
###### Logging
|
||||
|
||||
Logging
|
||||
*******
|
||||
|
||||
Symfony documentation: [How to user Monolog to write logs ](http://symfony.com/doc/current/cookbook/logging/monolog.html)
|
||||
.. seealso::
|
||||
|
||||
Symfony documentation: `How to user Monolog to write logs <http://symfony.com/doc/current/cookbook/logging/monolog.html>`_
|
||||
The symfony cookbook page about logging.
|
||||
|
||||
A channel for custom logging has been created to store sensitive data.
|
||||
|
||||
The channel is named ``chill``.
|
||||
A channel for custom logging has been created to store sensitive data.
|
||||
|
||||
The channel is named ``chill``.
|
||||
|
||||
The installer of chill should be aware that this channel may contains sensitive data and encrypted during backup.
|
||||
|
||||
## Logging to channel `chill`
|
||||
Logging to channel `chill`
|
||||
============================
|
||||
|
||||
You should use the service named ``chill.main.logger``, as this :
|
||||
You should use the service named ``chill.main.logger``, as this :
|
||||
|
||||
`$logger = $this->get('chill.main.logger');`
|
||||
.. code-block:: php
|
||||
|
||||
You should store data into context, not in the log himself, which should remains the same for the action.
|
||||
$logger = $this->get('chill.main.logger');
|
||||
|
||||
Example of usage :
|
||||
You should store data into context, not in the log himself, which should remains the same for the action.
|
||||
|
||||
Example of usage :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
$logger->info("An action has been performed about a person", array(
|
||||
'person_lastname' => $person->getLastName(),
|
||||
'person_firstname' => $person->getFirstName(),
|
||||
'person_id' => $person->getId(),
|
||||
'by_user' => $user->getUsername()
|
||||
));
|
||||
```
|
||||
|
||||
For further processing, it is a good idea to separate all fields (like firstname, lastname, ...) into different context keys.
|
||||
|
||||
By convention, you should store the username of the user performing the action under the ``by_user`` key.
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
.. 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".
|
||||
|
||||
###### Developer manual
|
||||
Developer manual
|
||||
*****************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
routing-and-menus.rst
|
||||
|
||||
|
||||
- [Routing and Menus](routing-and-menus.md)
|
||||
@@ -1,103 +1,143 @@
|
||||
###### Routing and menus
|
||||
.. 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".
|
||||
|
||||
The architecture of *Chill* allows choosing a bundle on each installation. This may lead to a huge diversity of installations, and the developper challenge is to make his code work with all those possibles installations.
|
||||
Routing and menus
|
||||
*****************
|
||||
|
||||
|
||||
The *Chill*'s architecture allows to choose bundle on each installation. This may lead to a huge diversity of installations, and a the developper challenge is to make his code working with all those possibles installations.
|
||||
|
||||
*Chill* uses menus to let users access easily to the most used functionalities. For instance, when you land on a "Person" page, you may access directly to his activities, notes, documents, ... in a single click on a side menu.
|
||||
|
||||
For a developer, it is easy to extend this menu with his own entries.
|
||||
|
||||
[Symfony documentation about routing ](http://symfony.com/doc/current/book/routing.html)
|
||||
.. seealso::
|
||||
|
||||
`Symfony documentation about routing <http://symfony.com/doc/current/book/routing.html>`_
|
||||
This documentation should be read before diving into those lines
|
||||
|
||||
[Routes dans Chill ](https://redmine.champs-libres.coop/issues/179) (FR)
|
||||
`Routes dans Chill <https://redmine.champs-libres.coop/issues/179>`_ (FR)
|
||||
The issue where we discussed routes. In French.
|
||||
|
||||
## Create routes
|
||||
Create routes
|
||||
==============
|
||||
|
||||
We recommend using `yaml` to define routes. We have not tested the existing other ways to create routes (annotations, ...). Help wanted.
|
||||
.. note::
|
||||
|
||||
The first step is as easy as creating a route in symfony, and add some options in his description :
|
||||
We recommand using `yaml` to define routes. We have not tested the existing other ways to create routes (annotations, ...). Help wanted.
|
||||
|
||||
The first step is as easy as create a route in symfony, and add some options in his description :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
```yaml
|
||||
#src/CL/ChillBundle/Resources/config/routing.yml
|
||||
chill_main_dummy_0:
|
||||
pattern: /dummy/{personId}
|
||||
defaults: { _controller: CLChillMainBundle:Default:index }
|
||||
options:
|
||||
#we begin menu information here :
|
||||
menus:
|
||||
foo: #must appear in a menu named 'foo'
|
||||
menus:
|
||||
foo: #must appears in menu named 'foo'
|
||||
order: 500 #the order will be '500'
|
||||
label: foolabel #the label shown on a menu. Will be translated
|
||||
otherkey: othervalue #you may add other information, as needed by your layout
|
||||
bar: #must also appear in a menu named 'bar'
|
||||
label: foolabel #the label shown on menu. Will be translated
|
||||
otherkey: othervalue #you may add other informations, as needed by your layout
|
||||
bar: #must also appears in menu named 'bar'
|
||||
order: 500
|
||||
label: barlabel
|
||||
```
|
||||
|
||||
The mandatory parameters under the `menus` definition are :
|
||||
The mandatory parameters under the `menus` definition are :
|
||||
|
||||
* `name`: the menu's name, defined as a key for the following entries
|
||||
* `order`. Note: if we have duplicate order's values, the order will be incremented. We recommend using big intervals within orders and publishing the orders in your documentation
|
||||
* `label`: the text which will be rendered inside the `<a>[ tag. The label should be processed trough the `trans` filter (`{{ route.label|trans }}`)
|
||||
* `name`: the menu's name, defined as an key for the following entries
|
||||
* `order`. Note: if we have duplicate order's values, the order will be incremented. We recommand using big intervals within orders and publishing the orders in your documentation
|
||||
* `label`: the text which will be rendered inside the `<a>` tag. The label should be processed trough the `trans` filter (`{{ route.label|trans }}`)
|
||||
|
||||
You *may* also add other keys, which will be used optionally in the way the menu is rendered. See
|
||||
You *may* also add other keys, which will be used optionally in the way the menu is rendered. See
|
||||
|
||||
Although all keys will be kept from your `yaml` definition to your menu template, we recommend not using those keys, which are reserved for a future implementations of Chill :
|
||||
.. warning::
|
||||
|
||||
* `helper`, a text to help user or add more information to him
|
||||
* `access` : which will run a test with `Expression Langage ](http://symfony.com/doc/current/components/expression_language/index.html) to determine if the user has the ACL to show the menu entry ;
|
||||
* `condition`, which will test with the menu context if the entry must appear
|
||||
Although all keys will be kept from your `yaml` definition to your menu template, we recommend not using those keys, which are reserved for a future implementations of Chill :
|
||||
|
||||
## Show menu in twig templates
|
||||
* `helper`, a text to help user or add more informations to him
|
||||
* `access` : which will run a test with `Expression Langage <http://symfony.com/doc/current/components/expression_language/index.html>`_ to determine if the user has the ACL to show the menu entry ;
|
||||
* `condition`, which will test with the menu context if the entry must appears
|
||||
|
||||
Show menu in twig templates
|
||||
===========================
|
||||
|
||||
To show our previous menu in the twig template, we invoke the `chill_menu` function. This will render the `foo` menu :
|
||||
|
||||
`{{ chill_menu('foo') }}`
|
||||
.. code-block:: jinja
|
||||
|
||||
##### Passing variables
|
||||
{{ chill_menu('foo') }}
|
||||
|
||||
Passing variables
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
If your routes need arguments, i.e. an entity id, you should pass the as argument to the chill_menu function. If your route's pattern is `/person/{personId}`, your code become :
|
||||
|
||||
`{{ chill_menu('foo', { 'args' : { 'personId' : person.id } } ) }}`
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'args' : { 'personId' : person.id } } ) }}
|
||||
|
||||
Of course, `person` is a variable you must define in your code, which should have an `id` accessible property (i.e. : `$person->getId()`).
|
||||
|
||||
.. note::
|
||||
|
||||
Be aware that your arguments will be passed to all routes in a menu. If a route does not require `personId` in his pattern, the route will become `/pattern?personId=XYZ`. This should not cause problem in your application.
|
||||
|
||||
It is a good idea to reuse the same parameter's name in your pattern, to avoid collision. Prefer `/person/{personId}` to `/person/{id}`.
|
||||
.. warning::
|
||||
|
||||
It is a good idea to reuse the same parameter's name in your pattern, to avoid collision. Prefer `/person/{personId}` to `/person/{id}`.
|
||||
|
||||
If you don't do that and another developer create a bundle with `person/{personId}/{id}` where `{id}` is the key for something else, this will cause a lot of trouble...
|
||||
|
||||
##### Rendering active entry
|
||||
Rendering active entry
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Now, you want to render differently the *active* route of the menu [#f1]_. You should, in your controller or template, add the active route in your menu :
|
||||
Now, you want to render differently the *active* route of the menu [#f1]_. You should, in your controller or template, add the active route in your menu :
|
||||
|
||||
`{{ chill_menu('foo', { 'activeRouteKey' : 'chill_main_dummy_0' } ) }}`
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'activeRouteKey' : 'chill_main_dummy_0' } ) }}
|
||||
|
||||
On menu creation, the route wich has the key `chill_main_dummy_0` will be rendered on a different manner.
|
||||
|
||||
### Define your own template
|
||||
Define your own template
|
||||
-------------------------
|
||||
|
||||
By default, the menu is rendered with the default template, which is a simple `ul` list. You may create your own templates :
|
||||
|
||||
```
|
||||
.. code-block:: html+jinja
|
||||
|
||||
#MyBundle/Resources/views/Menu/MyMenu.html.twig
|
||||
<ul class="myMenu">
|
||||
{% for route in routes %}
|
||||
<li><a href="{{ path(route.key, args ) }}" class="{%- if activeRouteKey == route.key -%}active{%- endif -%}">{{ route.label|trans }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
```
|
||||
|
||||
Arguments available in your template :
|
||||
|
||||
* The `args` value are the value passed in the 'args' arguments requested by the `chill_menu` function.
|
||||
* `activeRouteKey` is the key of the currently active route.
|
||||
* `activeRouteKey` is the key of the currently active route.
|
||||
* `routes` is an array of routes. The array has this structure: `routes[order] = { 'key' : 'the_route_key', 'label' : 'the route label' }` The order is *resolved*: in case of collision (two routes from different bundles having the same order), the order will be incremented. You may find in the array your own keys (`{ 'otherkey' : 'othervalue'}` in the example above).
|
||||
|
||||
Then, you will call your own template with the `layout` argument :
|
||||
|
||||
`{{ chill_menu('foo', { 'layout' : 'MyBundle:Menu:MyMenu.html.twig' } ) }}`
|
||||
.. code-block:: jinja
|
||||
|
||||
{{ chill_menu('foo', { 'layout' : 'MyBundle:Menu:MyMenu.html.twig' } ) }}
|
||||
|
||||
.. note::
|
||||
|
||||
Take care of specifying the absolute path to layout in the function.
|
||||
|
||||
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
.. [#f1] In the default template, the currently active entry will be rendered with an "active" class : `<li class="active"> ... </li>`
|
||||
@@ -1,25 +1,44 @@
|
||||
###### Menus
|
||||
.. 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".
|
||||
|
||||
.. _menus :
|
||||
|
||||
Menus
|
||||
*****
|
||||
|
||||
Chill has created his own menu system
|
||||
|
||||
[Routes dans Chill [specification] ](https://redmine.champs-libres.coop/issues/179)
|
||||
.. seealso::
|
||||
|
||||
`Routes dans Chill [specification] <https://redmine.champs-libres.coop/issues/179>`_
|
||||
The issue wich discussed the implementation of routes.
|
||||
|
||||
## Concepts
|
||||
Concepts
|
||||
========
|
||||
|
||||
.. warning::
|
||||
|
||||
to be written
|
||||
|
||||
## Add a menu in a template
|
||||
|
||||
|
||||
Add a menu in a template
|
||||
========================
|
||||
|
||||
In your twig template, use the `chill_menu` function :
|
||||
|
||||
```php
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ chill_menu('person', {
|
||||
'layout': 'ChillPersonBundle::menu.html.twig',
|
||||
'args': {'id': person.id },
|
||||
'args' : {'id': person.id },
|
||||
'activeRouteKey': 'chill_person_view'
|
||||
}) }}
|
||||
```
|
||||
|
||||
The available arguments are:
|
||||
|
||||
@@ -27,61 +46,78 @@ The available arguments are:
|
||||
* `args` : those arguments will be passed through the url generator.
|
||||
* `activeRouteKey` must be the route key name.
|
||||
|
||||
.. note::
|
||||
|
||||
The argument `activeRouteKey` may be a twig variable, defined elsewhere in your template, even in child templates.
|
||||
|
||||
## Create an entry in an existing menu
|
||||
|
||||
|
||||
Create an entry in an existing menu
|
||||
===================================
|
||||
|
||||
If a route belongs to a menu, you simply add this to his definition in routing.yml :
|
||||
|
||||
```yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_history_list:
|
||||
pattern: /person/{person_id}/history
|
||||
defaults: { _controller: ChillPersonBundle:History:list }
|
||||
options:
|
||||
#declare menus
|
||||
menus:
|
||||
# the route should be in the 'person' menu :
|
||||
menus:
|
||||
# the route should be in 'person' menu :
|
||||
person:
|
||||
#and have those arguments :
|
||||
order: 100
|
||||
label: menu.person.history
|
||||
```
|
||||
|
||||
* `order` (mandatory): the order in the menu. It is preferrable to increment by far more than 1.
|
||||
* `label` (mandatory): a translatable string.
|
||||
* `helper` (optional): a text to help people to understand what does the menu do. Not used in default implementation.
|
||||
* `condition` (optional): an `Expression Language <http://symfony.com/doc/current/components/expression_language/index.html> `_ which will make the menu appears or not. Typically, it may be used to say "show this menu only if the person concerned is more than 18". **Not implemented yet**.
|
||||
* `access` (optional): an Expression Language to evalute the possibility, for the user, to show this menu according to Access Control Model. **Not implemented yet.**
|
||||
* `order` (mandatory) : the order in the menu. It is preferrable to increment by far more than 1.
|
||||
* `label` (mandatory) : a translatable string.
|
||||
* `helper` (optional) : a text to help people to understand what does the menu do. Not used in default implementation.
|
||||
* `condition` (optional) : an `Expression Language <http://symfony.com/doc/current/components/expression_language/index.html> `_ which will make the menu appears or not. Typically, it may be used to say "show this menu only if the person concerned is more than 18". **Not implemented yet**.
|
||||
* `access` (optional) : an Expression Language to evalute the possibility, for the user, to show this menu according to Access Control Model. **Not implemented yet.**
|
||||
|
||||
You may add additional keys, but should not use the keys described above.
|
||||
|
||||
You may add the same route to multiple menus :
|
||||
|
||||
```yaml
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_person_history_list:
|
||||
pattern: /person/{person_id}/history
|
||||
defaults: { _controller: ChillPersonBundle:History:list }
|
||||
options:
|
||||
menus:
|
||||
menus:
|
||||
menu1:
|
||||
order: 100
|
||||
label: menu.person.history
|
||||
menu2:
|
||||
order: 100
|
||||
label: another.label
|
||||
```
|
||||
|
||||
## Customize menu rendering
|
||||
|
||||
|
||||
Customize menu rendering
|
||||
========================
|
||||
|
||||
You may customize menu rendering by using the `layout` option.
|
||||
|
||||
.. warning ::
|
||||
|
||||
TODO : this part should be written.
|
||||
|
||||
TODO: this part should be written.
|
||||
|
||||
## Caveats
|
||||
|
||||
|
||||
|
||||
|
||||
.. _caveats :
|
||||
|
||||
Caveats
|
||||
=======
|
||||
|
||||
Currently, you may pass arguments globally to each menu, and they will be all passed to route url. This means that :
|
||||
|
||||
* the argument name in the route entry must match the argument key in the menu declaration in the twig template
|
||||
* the argument name in the route entry must match the argument key in menu declaration in twig template
|
||||
* if an argument is missing to generate an url, the url generator will throw a `Symfony\Component\Routing\Exception\MissingMandatoryParametersException`
|
||||
* if the argument name is not declared in route entry, it will be added to the url, (example: `/my/route?additional=foo`)
|
||||
@@ -1,93 +0,0 @@
|
||||
###### Messages to users, flashbags, and buttons
|
||||
|
||||
## Flashbags
|
||||
|
||||
The four following levels are defined :
|
||||
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|Key|Intent |
|
||||
|success|The user action succeeds. |
|
||||
|notice|A simple message to give information to the user. The message may be linked or not linked with |
|
||||
||the user action. |
|
||||
|error|The user's action failed: he must correct something to process the action. |
|
||||
|
||||
We can use [TranslatableMessage` (and other `TranslatableMessageInterface` instances) into the controller:
|
||||
|
||||
```php
|
||||
// in a controller action:
|
||||
if (($session = $request->getSession()) instanceof Session) {
|
||||
$session->getFlashBag()->add(
|
||||
'success',
|
||||
new TranslatableMessage('saved_export.Saved export is saved!')
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
`Flash Messages on Symfony documentation ](http://symfony.com/doc/current/book/controller.html#flash-messages)
|
||||
Learn how to use flash messages in a controller.
|
||||
|
||||
## Buttons
|
||||
|
||||
Some actions are available to decorate ``a`` links and ``buttons``.
|
||||
|
||||
To add the action on button, use them as class along with ``sc-button`` :
|
||||
|
||||
<a class="sc-button bt-create">Create an entity</a>
|
||||
|
||||
<button class="sc-button bt-submit" type="submit">Submit</button>
|
||||
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Action | Class | Description |
|
||||
| Submit | ``bt-submit`` | Submit a form. Use only if the action is not "save." |
|
||||
| Create | ``bt-create`` | - Link to a form to create an entity (alias: ``bt-new``) |
|
||||
| | or ``bt-new`` | - Submitting this form will create a new entity |
|
||||
| Reset | ``bt-reset`` | Reset a form |
|
||||
| Delete | ``bt-delete`` | - Link to a form to delete an entity |
|
||||
| | | - Submitting this form will remove the entity |
|
||||
| Edit | ``bt-edit`` or | Link to a form to edit an entity |
|
||||
| | ``bt-update`` | |
|
||||
| Save | ``bt-save`` | Submitting this form will save change on the entity |
|
||||
| Action | ``bt-action`` | Generic link to an action |
|
||||
| Cancel | ``bt-cancel`` | Cancel an action and go back to another page |
|
||||
|
||||
### Styling buttons
|
||||
|
||||
Small buttons, mainly to use inline
|
||||
|
||||
`<p><a class="sc-button bt-create bt-small">You button</a></p>`
|
||||
|
||||
You can omit content and show a button with an icon only :
|
||||
|
||||
`<a class="sc-button bt-create"></a>`
|
||||
|
||||
You can hide content and show it only on hover
|
||||
|
||||
`<a class="sc-button bt-create has-hidden"><span class="show-on-hover">Showed when mouse pass on</span></a>`
|
||||
|
||||
You can customize the icon :
|
||||
|
||||
`<a class="sc-button bt-create change-icon"><i class="fa fa-icon"></i>Button with custom icon</a>`
|
||||
|
||||
### Grouping buttons
|
||||
|
||||
Grouping buttons can be done using ``ul.record_actions`` element (an ``ul`` list with class ``record_actions``):
|
||||
|
||||
```html
|
||||
<ul class="record_actions">
|
||||
|
||||
<li class="cancel">
|
||||
<a class="sc-button bt-cancel">Cancel</a>
|
||||
<li>
|
||||
|
||||
<li>
|
||||
<a class="sc-button bt-save">Save</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
```
|
||||
|
||||
The element with the ``cancel`` class will be set in first position.
|
||||
|
||||
Inside the table, the space between elements will be shorter.
|
||||
|
||||
You can add the class ``record_actions_small`` if you want shorter space between elements.
|
||||
136
docs/source/development/messages-to-users.rst
Normal file
136
docs/source/development/messages-to-users.rst
Normal file
@@ -0,0 +1,136 @@
|
||||
.. 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".
|
||||
|
||||
Messages to users, flashbags and buttons
|
||||
****************************************
|
||||
|
||||
|
||||
.. _flashbags :
|
||||
|
||||
Flashbags
|
||||
==========
|
||||
|
||||
The four following levels are defined :
|
||||
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|Key |Intent |
|
||||
+===========+==============================================================================================+
|
||||
|success |The user action succeeds. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|notice |A simple message to give information to the user. The message may be linked or not linked with|
|
||||
| |the user action. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|error |The user's action failed: he must correct something to process the action. |
|
||||
+-----------+----------------------------------------------------------------------------------------------+
|
||||
|
||||
We can use :code:`TranslatableMessage` (and other :code:`TranslatableMessageInterface` instances) into the controller:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// in a controller action:
|
||||
if (($session = $request->getSession()) instanceof Session) {
|
||||
$session->getFlashBag()->add(
|
||||
'success',
|
||||
new TranslatableMessage('saved_export.Saved export is saved!')
|
||||
);
|
||||
}
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Flash Messages on Symfony documentation <http://symfony.com/doc/current/book/controller.html#flash-messages>`_
|
||||
Learn how to use flash messages in controller.
|
||||
|
||||
|
||||
Buttons
|
||||
========
|
||||
|
||||
Some actions are available to decorate ``a`` links and ``buttons``.
|
||||
|
||||
To add the action on button, use them as class along with ``sc-button`` :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create">Create an entity</a>
|
||||
|
||||
<button class="sc-button bt-submit" type="submit">Submit</button>
|
||||
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Action | Class | Description |
|
||||
+===========+================+==============================================================================+
|
||||
| Submit | ``bt-submit`` | Submit a form. Use only if action is not "save". |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Create | ``bt-create`` | - Link to a form to create an entity (alias: ``bt-new``) |
|
||||
| | or ``bt-new`` | - Submitting this form will create a new entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Reset | ``bt-reset`` | Reset a form |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Delete | ``bt-delete`` | - Link to a form to delete an entity |
|
||||
| | | - Submitting this form will remove the entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Edit | ``bt-edit`` or | Link to a form to edit an entity |
|
||||
| | ``bt-update`` | |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Save | ``bt-save`` | Submitting this form will save change on the entity |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Action | ``bt-action`` | Generic link to an action |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
| Cancel | ``bt-cancel`` | Cancel an action and go back to another page |
|
||||
+-----------+----------------+------------------------------------------------------------------------------+
|
||||
|
||||
Styling buttons
|
||||
---------------
|
||||
|
||||
Small buttons, mainly to use inline
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<p><a class="sc-button bt-create bt-small">You button</a></p>
|
||||
|
||||
You can omit content and show a button with an icon only :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create"></a>
|
||||
|
||||
You can hide content and show it only on hover
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create has-hidden"><span class="show-on-hover">Showed when mouse pass on</span></a>
|
||||
|
||||
You can customize the icon :
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<a class="sc-button bt-create change-icon"><i class="fa fa-icon"></i>Button with custom icon</a>
|
||||
|
||||
Grouping buttons
|
||||
----------------
|
||||
|
||||
Grouping buttons can be done using ``ul.record_actions`` element (an ``ul`` list with class ``record_actions``):
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<ul class="record_actions">
|
||||
|
||||
<li class="cancel">
|
||||
<a class="sc-button bt-cancel">Cancel</a>
|
||||
<li>
|
||||
|
||||
<li>
|
||||
<a class="sc-button bt-save">Save</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
The element with the ``cancel`` class will be set in first position.
|
||||
|
||||
Inside table, the space between elements will be shorter.
|
||||
|
||||
You can add the class ``record_actions_small`` if you want shorter space between elements.
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
###### Database Migrations
|
||||
|
||||
Every bundle potentially brings his own database operations: to persist entities, developers have to create database schema, creating indexes,...
|
||||
|
||||
Those schemas might be changed (the less is the better) from time to time.
|
||||
|
||||
Consequence: each bundle should bring his own migration files, which will bring the database consistent with the operation you will run in your code. They will be gathered into the app installation, ready to be executed by the chill's installer.
|
||||
|
||||
Currently, we use `doctrine migration`_ to manage those migration files. A `composer`_ script located in the **chill standard** component will copy the migrations from your bundle to the doctrne migration's excepted directory after each install and/or update operation.
|
||||
|
||||
The `doctrine migration`_ documentation
|
||||
Learn concepts about migration files and scripts and the doctrine ORM
|
||||
|
||||
The `doctrine migration bundle`_ documentation
|
||||
Learn about doctrine migration integration with a Symfony framework
|
||||
|
||||
## Shipping migration files
|
||||
|
||||
Migration files should be shipped under the Resource/migrations directory. You could customize the migration directory by adding extra information in your composer.json:
|
||||
|
||||
```
|
||||
"extra": {
|
||||
"migration-source": "path/to/my/dir"
|
||||
}
|
||||
```
|
||||
|
||||
The class namespace should be `Application\Migrations`, as expected by doctrine migration. Only the files which will be executed by doctrine migration will be moved: they must have the pattern `VersionYYYYMMDDHHMMSS.php` where YYYY is the year, MM the month, DD the day, HH the hour, MM the month and SS the second of creation.
|
||||
|
||||
They will be moved automatically by composer when you install or update a bundle.
|
||||
|
||||
## Executing migration files
|
||||
|
||||
The installers will have to execute migration files manually, running
|
||||
|
||||
`php app/console doctrine:migrations:status #will give the current status of the database`
|
||||
`php app/console doctrine:migrations:migrate #process the update`
|
||||
|
||||
## Updating migration files
|
||||
|
||||
After an installation, migration files will be executed and registered as executed in the database (the version timestamp is recorded into the :title:`migrations_versions` table). If you update your migration file code, the file will still be considered as "executed" by doctrine migration, which will not offers the possibility to run the migration again.
|
||||
|
||||
Consequently, updating a migration file should only be considered during the development phase and not published on public git branches. If you want to edit your database schema, you should create a new migration file, with a new timestamp, which will proceed to your schema adaptations.
|
||||
|
||||
Every time a migration file is discovered, the composer script will check if the migration exists in the local migration directory. If yes, the script will compare two file for changes (using a md5 hash). If migrations are discovered, the script will ask the installer to know if he must replace the file or ignore it.
|
||||
|
||||
You can manually run a composer script by launching `composer run-script post-update-cmd` from your root chill installation's directory.
|
||||
|
||||
## Tips for development
|
||||
|
||||
### Migration and data
|
||||
|
||||
Each time you create a migration script, you should ensure that it will not lead to data losing. Eventually, feel free to use intermediate steps.
|
||||
|
||||
### Generation
|
||||
|
||||
You can generate a migration file from the command line, using those commands:
|
||||
|
||||
* `php app/console doctrine:migrations:diff` to generate a migration file by comparing your current database to your mapping information
|
||||
* `php app/console doctrine:migrations:generate` to generate a blank migration file.
|
||||
|
||||
Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resources/migrations` into your bundle directory.
|
||||
|
||||
### Comments and documentation
|
||||
|
||||
As files are copied from your bundle to the `app/DoctrineMigrations` directory, the link between your bundle and the copied file will be unclear. Please add all relevant documentation which will allow future developers to make a link between your file and your bundle.
|
||||
|
||||
### Inside the script
|
||||
|
||||
The script that moves the migration files to app directory `might be found here
|
||||
<https://github.com/Champs-Libres/ComposerBundleMigration/blob/master/Composer/Migrations.php>
|
||||
101
docs/source/development/migrations.rst
Normal file
101
docs/source/development/migrations.rst
Normal file
@@ -0,0 +1,101 @@
|
||||
.. 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".
|
||||
|
||||
Database Migrations
|
||||
********************
|
||||
|
||||
Every bundle potentially brings his own database operations : to persist entities, developers have to create database schema, creating indexes,...
|
||||
|
||||
Those schema might be changed (the less is the better) from time to time.
|
||||
|
||||
Consequence: each bundle should bring his own migration files, which will bring the database consistent with the operation you will run in your code. They will be gathered into the app installation, ready to be executed by the chill's installer.
|
||||
|
||||
Currently, we use `doctrine migration`_ to manage those migration files. A `composer`_ script located in the **chill standard** component will copy the migrations from your bundle to the doctrne migration's excepted directory after each install and/or update operation.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The `doctrine migration`_ documentation
|
||||
Learn concepts about migrations files and scripts and the doctrine ORM
|
||||
|
||||
The `doctrine migration bundle`_ documentation
|
||||
Learn about doctrine migration integration with Symfony framework
|
||||
|
||||
Shipping migration files
|
||||
========================
|
||||
|
||||
Migrations files should be shipped under the Resource/migrations directory. You could customize the migration directory by adding extra information in your composer.json:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"extra": {
|
||||
"migration-source": "path/to/my/dir"
|
||||
}
|
||||
|
||||
The class namespace should be `Application\Migrations`, as expected by doctrine migration. Only the files which will be executed by doctrine migration will be moved: they must have the pattern `VersionYYYYMMDDHHMMSS.php` where YYYY is the year, MM the month, DD the day, HH the hour, MM the month and SS the second of creation.
|
||||
|
||||
They will be moved automatically by composer when you install or update a bundle.
|
||||
|
||||
Executing migration files
|
||||
==========================
|
||||
|
||||
The installers will have to execute migrations files manually, running
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console doctrine:migrations:status #will give the current status of the database
|
||||
php app/console doctrine:migrations:migrate #process the update
|
||||
|
||||
|
||||
Updating migration files
|
||||
=========================
|
||||
|
||||
.. warning::
|
||||
|
||||
After an installation, migration files will be executed and registered as executed in the database (the version timestamp is recorded into the :title:`migrations_versions` table). If you update your migration file code, the file will still be considered as "executed" by doctrine migration, which will not offers the possibility to run the migration again.
|
||||
|
||||
Consequently, updating migration file should only be considered during development phase, and not published on public git branches. If you want to edit your database schema, you should create a new migration file, with a new timestamp, which will proceed to your schema adaptations.
|
||||
|
||||
Every time a migration file is discovered, the composer'script will check if the migration exists in the local migration directory. If yes, the script will compare two file for changes (using a md5 hash). If migrations are discovered, the script will ask the installer to know if he must replace the file or ignore it.
|
||||
|
||||
.. note::
|
||||
|
||||
You can manually run composer script by launching `composer run-script post-update-cmd` from your root chill installation's directory.
|
||||
|
||||
|
||||
.. _doctrine migration: http://www.doctrine-project.org/projects/migrations.html
|
||||
.. _doctrine migration bundle : http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
|
||||
.. _composer : https://getcomposer.org
|
||||
|
||||
Tips for development
|
||||
====================
|
||||
|
||||
Migration and data
|
||||
------------------
|
||||
|
||||
Each time you create a migration script, you should ensure that it will not lead to data losing. Eventually, feel free to use intermediate steps.
|
||||
|
||||
Generation
|
||||
----------
|
||||
|
||||
You can generate migration file from the command line, using those commands:
|
||||
|
||||
* `php app/console doctrine:migrations:diff` to generate a migration file by comparing your current database to your mapping information
|
||||
* `php app/console doctrine:migrations:generate` to generate a blank migration file.
|
||||
|
||||
Those files will be located into `app/DoctrineMigrations` directory. You will have to copy those file to your the directory `Resources/migrations` into your bundle directory.
|
||||
|
||||
Comments and documentation
|
||||
--------------------------
|
||||
|
||||
As files are copied from your bundle to the `app/DoctrineMigrations` directory, the link between your bundle and the copied file will be unclear. Please add all relevant documentation which will allow future developers to make a link between your file and your bundle.
|
||||
|
||||
Inside the script
|
||||
-----------------
|
||||
|
||||
The script which move the migrations files to app directory `might be found here
|
||||
<https://github.com/Champs-Libres/ComposerBundleMigration/blob/master/Composer/Migrations.php>
|
||||
@@ -1,153 +0,0 @@
|
||||
# Pagination
|
||||
|
||||
The Bundle `Chill\MainBundle` provides a **Pagination** api which allow you to easily divide result list on different pages.
|
||||
|
||||
###### A simple example
|
||||
|
||||
In the controller, get the `Chill\Main\Pagination\PaginatorFactory` from the `Container` and use this `PaginatorFactory` to create a `Paginator` instance.
|
||||
|
||||
```php
|
||||
|
||||
Then, render the pagination using the dedicated twig function.
|
||||
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% block title 'Item list'|trans %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<table>
|
||||
|
||||
{# ... your items here... #}
|
||||
|
||||
</table>
|
||||
|
||||
{% if items|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
```
|
||||
|
||||
The function `chill_pagination` will, by default, render a link to the 10 previous page (if they exists) and the 10 next pages (if they exists). Assuming that we are on page 5, the function will render a list to ::
|
||||
|
||||
Previous 1 2 3 4 **5** 6 7 8 9 10 11 12 13 14 Next
|
||||
|
||||
## Understanding the magic
|
||||
|
||||
### Where does the `$paginator` get the page number ?
|
||||
|
||||
Internally, the `$paginator` object has a link to the `Request` object, and it reads the `page` parameter which contains the current page number. If this parameter is not present, the `$paginator` assumes that we are on page 1.
|
||||
|
||||
The `$paginator` get the current page from the request.
|
||||
|
||||
### Where does the `$paginator` get the number of items per page ?
|
||||
|
||||
As above, the `$paginator` can get the number of items per page from the `Request`. If none is provided, this is given by the configuration which is, by default, 50 items per page.
|
||||
|
||||
###### `PaginatorFactory`, `Paginator` and `Page`
|
||||
|
||||
## `PaginatorFactory`
|
||||
|
||||
The `PaginatorFactory` may create more than one `Paginator` in a single action. Those `Paginator` instance may redirect to different routes and/or routes parameters.
|
||||
|
||||
// create a paginator for the route 'my_route' with some parameters (arg1 and arg2)
|
||||
`$paginatorMyRoute = $paginatorFactory->create($total, 'my_route', array('arg1' => 'foo', 'arg2' => $bar);`
|
||||
Those parameters will override the current parameters.
|
||||
|
||||
The `PaginatorFactory` has also some useful shortcuts :
|
||||
|
||||
// get current page number
|
||||
`$paginatorFactory->getCurrentPageNumber()`
|
||||
// get the number of items per page **for the current request**
|
||||
`$paginatorFactory->getCurrentItemsPerPage()`
|
||||
// get the number of the first item **for the current page**
|
||||
`$paginatorFactory->getCurrentPageFirstItemNumber()`
|
||||
|
||||
## Working with `Paginator` and `Page`
|
||||
|
||||
The paginator has a function to give the number of pages that are required to display all the results and give some information about the number of items per page :
|
||||
|
||||
// how many page count this paginator ?
|
||||
`$paginator->countPages(); // return 20 in our example`
|
||||
|
||||
// we may get the number of items per page
|
||||
`$paginator->getItemsPerPage(); // return 20 in our example`
|
||||
|
||||
A `Paginator` instance create instance of `Page`, each `Page`, which is responsible for generating the URL to the page number it represents. Here are some possibilities using `Page` and `Paginator` :
|
||||
|
||||
Get the current page
|
||||
`$page = $paginator->getCurrentPage();`
|
||||
On which page are we?
|
||||
`$page->getNumber(); // return 5 in this example (we are on page 5)`
|
||||
Generate the url for page 5
|
||||
`$page->generateUrl(); // return '/<your route here>?page=5`
|
||||
What is the first item number on this page ?
|
||||
`$page->getFistItemNumber(); // return 101 in our example (20 items per page)`
|
||||
What is the last item number on this page?
|
||||
`$page->getLastItemNumber(); // return 120 in our example`
|
||||
|
||||
We can access directly the next and current page
|
||||
```
|
||||
if ($paginator->hasNextPage()) {
|
||||
$next = $paginator->getNextPage();
|
||||
}
|
||||
if ($paginator->hasPreviousPage()) {
|
||||
$previous = $paginator->getPreviousPage();
|
||||
}
|
||||
```
|
||||
|
||||
We can access directly to a given page number
|
||||
```
|
||||
$page10 = $paginator->getPage(10);``
|
||||
if ($paginator->hasPage(10)) {
|
||||
$page10 = $paginator->getPage(10);
|
||||
}
|
||||
```
|
||||
|
||||
We can iterate over our pages through a generator
|
||||
```
|
||||
foreach ($paginator->getPagesGenerator() as $page) {
|
||||
$page->getNumber();
|
||||
}
|
||||
```
|
||||
|
||||
Check that a page object is the current page
|
||||
|
||||
`$paginator->isCurrentPage($page); // return false`
|
||||
|
||||
When calling a page which does not exist, the [Paginator` will throw a `RuntimeException`. Example :
|
||||
|
||||
Our last page is 10
|
||||
|
||||
`$paginator->getPage(99); // out of range => throw RuntimeException`
|
||||
|
||||
Our current page is 1 (the first page)
|
||||
`$paginator->getPreviousPage; // does not exists (the fist page is always 1) => throw RuntimeException`
|
||||
|
||||
When you create a `Paginator` for the current route and route parameters, the `Page` instances will keep the same parameters and routes :
|
||||
|
||||
```php
|
||||
// assuming our route is 'my_route', for the pattern '/my/{foo}/route',
|
||||
// and the current route is '/my/value/route?arg2=bar'
|
||||
```
|
||||
|
||||
Create a paginator for the current route and route parameters :
|
||||
`$paginator = $paginatorFactory->create($total);`
|
||||
|
||||
Get the next page
|
||||
```
|
||||
if ($paginator->hasNext()) {
|
||||
$next = $paginator->getNextPage();
|
||||
|
||||
// get the route to the page
|
||||
$page->generateUrl(); // will print 'my/value/route?arg2=bar&page=2'
|
||||
}
|
||||
```
|
||||
Having a look at the `full classes' documentation may provide some [ useful information ](http://api.chill.social/Chill-Main/master/namespace-Chill.MainBundle.Pagination.html).
|
||||
|
||||
###### Customizing the rendering of twig's [chill_pagination`
|
||||
|
||||
You can provide your own layout for rendering the pagination: provides your twig template as a second argument :
|
||||
|
||||
{{ chill_pagination(paginator, 'MyBundle:Pagination:MyTemplate.html.twig') }}
|
||||
|
||||
The template will receive the `$paginator` as `paginator` variable. Let's have a look `at the [ current template ](https://framagit.org/Chill-project/Chill-Main/blob/master/Resources/views/Pagination/long.html.twig).
|
||||
191
docs/source/development/pagination.rst
Normal file
191
docs/source/development/pagination.rst
Normal file
@@ -0,0 +1,191 @@
|
||||
.. Copyright (C) 2016 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".
|
||||
|
||||
|
||||
.. _pagination-ref:
|
||||
|
||||
Pagination
|
||||
##########
|
||||
|
||||
The Bundle :code:`Chill\MainBundle` provides a **Pagination** api which allow you to easily divide results list on different pages.
|
||||
|
||||
A simple example
|
||||
****************
|
||||
|
||||
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
|
||||
:language: php
|
||||
|
||||
|
||||
Then, render the pagination using the dedicated twig function.
|
||||
|
||||
.. code-block:: html+twig
|
||||
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% block title 'Item list'|trans %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<table>
|
||||
|
||||
{# ... your items here... #}
|
||||
|
||||
</table>
|
||||
|
||||
{% if items|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
The function :code:`chill_pagination` will, by default, render a link to the 10 previous page (if they exists) and the 10 next pages (if they exists). Assuming that we are on page 5, the function will render a list to ::
|
||||
|
||||
Previous 1 2 3 4 **5** 6 7 8 9 10 11 12 13 14 Next
|
||||
|
||||
Understanding the magic
|
||||
=======================
|
||||
|
||||
Where does the :code:`$paginator` get the page number ?
|
||||
-------------------------------------------------------
|
||||
|
||||
Internally, the :code:`$paginator` object has a link to the :code:`Request` object, and it reads the :code:`page` parameter which contains the current page number. If this parameter is not present, the :code:`$paginator` assumes that we are on page 1.
|
||||
|
||||
.. figure:: /_static/puml/pagination-sequence.png
|
||||
|
||||
The :code:`$paginator` get the current page from the request.
|
||||
|
||||
Where does the :code:`$paginator` get the number of items per page ?
|
||||
--------------------------------------------------------------------
|
||||
|
||||
As above, the :code:`$paginator` can get the number of items per page from the :code:`Request`. If none is provided, this is given by the configuration which is, by default, 50 items per page.
|
||||
|
||||
:code:`PaginatorFactory`, :code:`Paginator` and :code:`Page`
|
||||
************************************************************
|
||||
|
||||
:code:`PaginatorFactory`
|
||||
========================
|
||||
|
||||
The :code:`PaginatorFactory` may create more than one :code:`Paginator` in a single action. Those :code:`Paginator` instance may redirect to different routes and/or routes parameters.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// create a paginator for the route 'my_route' with some parameters (arg1 and arg2)
|
||||
$paginatorMyRoute = $paginatorFactory->create($total, 'my_route', array('arg1' => 'foo', 'arg2' => $bar);
|
||||
|
||||
Those parameters will override the current parameters.
|
||||
|
||||
The :code:`PaginatorFactory` has also some useful shortcuts :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// get current page number
|
||||
$paginatorFactory->getCurrentPageNumber( )
|
||||
// get the number of items per page **for the current request**
|
||||
$paginatorFactory->getCurrentItemsPerPage( )
|
||||
// get the number of the first item **for the current page**
|
||||
$paginatorFactory->getCurrentPageFirstItemNumber( )
|
||||
|
||||
|
||||
Working with :code:`Paginator` and :code:`Page`
|
||||
===============================================
|
||||
|
||||
The paginator has some function to give the number of pages are required to displayed all the results, and give some information about the number of items per page :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// how many page count this paginator ?
|
||||
$paginator->countPages(); // return 20 in our example
|
||||
|
||||
// we may get the number of items per page
|
||||
$paginator->getItemsPerPage(); // return 20 in our example
|
||||
|
||||
A :code:`Paginator` instance create instance of :code:`Page`, each :code:`Page`, which is responsible for generating the URL to the page number it represents. Here are some possibilities using :code:`Page` and :code:`Paginator` :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// get the current page
|
||||
$page = $paginator->getCurrentPage();
|
||||
// on which page are we ?
|
||||
$page->getNumber(); // return 5 in this example (we are on page 5)
|
||||
// generate the url for page 5
|
||||
$page->generateUrl(); // return '/<your route here>?page=5
|
||||
// what is the first item number on this page ?
|
||||
$page->getFistItemNumber(); // return 101 in our example (20 items per page)
|
||||
// what is the last item number on this page ?
|
||||
$page->getLastItemNumber(); // return 120 in our example
|
||||
|
||||
// we can access directly the next and current page
|
||||
if ($paginator->hasNextPage()) {
|
||||
$next = $paginator->getNextPage();
|
||||
}
|
||||
if ($paginator->hasPreviousPage()) {
|
||||
$previous = $paginator->getPreviousPage();
|
||||
}
|
||||
|
||||
// we can access directly to a given page number
|
||||
if ($paginator->hasPage(10)) {
|
||||
$page10 = $paginator->getPage(10);
|
||||
}
|
||||
|
||||
// we can iterate over our pages through a generator
|
||||
foreach ($paginator->getPagesGenerator() as $page) {
|
||||
$page->getNumber();
|
||||
}
|
||||
|
||||
// check that a page object is the current page
|
||||
$paginator->isCurrentPage($page); // return false
|
||||
|
||||
.. warning::
|
||||
|
||||
When calling a page which does not exists, the :code:`Paginator` will throw a `RuntimeException`. Example :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// our last page is 10
|
||||
$paginator->getPage(99); // out of range => throw `RuntimeException`
|
||||
|
||||
// our current page is 1 (the first page)
|
||||
$paginator->getPreviousPage; // does not exists (the fist page is always 1) => throw `RuntimeException`
|
||||
|
||||
.. note::
|
||||
|
||||
When you create a :code:`Paginator` for the current route and route parameters, the :code:`Page` instances will keep the same parameters and routes :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// assuming our route is 'my_route', for the pattern '/my/{foo}/route',
|
||||
// and the current route is '/my/value/route?arg2=bar'
|
||||
|
||||
// create a paginator for the current route and route parameters :
|
||||
$paginator = $paginatorFactory->create($total);
|
||||
|
||||
// get the next page
|
||||
if ($paginator->hasNext()) {
|
||||
$next = $paginator->getNextPage();
|
||||
|
||||
// get the route to the page
|
||||
$page->generateUrl(); // will print 'my/value/route?arg2=bar&page=2'
|
||||
}
|
||||
|
||||
|
||||
Having a look to the `full classes documentation may provide some useful information <http://api.chill.social/Chill-Main/master/namespace-Chill.MainBundle.Pagination.html>`_.
|
||||
|
||||
|
||||
Customizing the rendering of twig's :code:`chill_pagination`
|
||||
************************************************************
|
||||
|
||||
You can provide your own layout for rendering the pagination: provides your twig template as a second argument :
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{{ chill_pagination(paginator, 'MyBundle:Pagination:MyTemplate.html.twig') }}
|
||||
|
||||
The template will receive the :code:`$paginator` as :code:`paginator` variable. Let's have a look `at the current template <https://framagit.org/Chill-project/Chill-Main/blob/master/Resources/views/Pagination/long.html.twig>`_.
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
# Rendering entity automatically
|
||||
|
||||
Rendering entity automatically
|
||||
##############################
|
||||
|
||||
Some entity need to be rendered automatically for a couple of times: a person, a user, ...
|
||||
|
||||
One can use some twig filter to render those entities:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
{{ person|chill_entity_render_box }}
|
||||
|
||||
## Define a renderer
|
||||
Define a renderer
|
||||
=================
|
||||
|
||||
By default, the object passed through the renderer will be rendered using the `__toString()` method. To customize this behaviour, you have to define a service and tag it using `chill.render_entity`.
|
||||
By default, the object passed through the renderer will be rendered using the :code:`__toString()` method. To customize this behaviour, you have to define a service and tag it using :code:`chill.render_entity`.
|
||||
|
||||
The rendered is implemented using :class:`Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface`. This interface has 3 methods:
|
||||
|
||||
* `public function supports($entity, array $options): bool`: return true if the `$entity` given in parameter, with custom options, is supported by this renderer;
|
||||
* `public function renderString($entity, array $options): string`: render the entity as a single string, for instance in a select list;
|
||||
* `public function renderBox($entity, array $options): string`: render the entity in a HTML box.
|
||||
* :code:`public function supports($entity, array $options): bool`: return true if the :code:`$entity` given in parameter, with custom options, is supported by this renderer;
|
||||
* :code:`public function renderString($entity, array $options): string`: render the entity as a single string, for instance in a select list;
|
||||
* :code:`public function renderBox($entity, array $options): string`: render the entity in an html box.
|
||||
|
||||
The HTML returned by `renderBox` **MUST BE SAFE** of any XSS injection.
|
||||
.. warning::
|
||||
|
||||
`Chill\MainBundle\Templating\Entity\AbstractChillEntityRender` provides some useful methods to get the opening and closing boxes that should be used.
|
||||
The HTML returned by :code:`renderBox` **MUST BE SAFE** of any XSS injection.
|
||||
|
||||
:class:`Chill\MainBundle\Templating\Entity\AbstractChillEntityRender` provides some useful methods to get the opening and closing boxes that should be used.
|
||||
|
||||
Usage about rendering comment:
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
@@ -100,41 +108,47 @@ Usage about rendering comment:
|
||||
return $entity instanceof CommentEmbeddable;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Logic inside the template:
|
||||
|
||||
```twig
|
||||
{# @var opening_box: string #}
|
||||
{# @var closing_box: string #}
|
||||
.. code-block:: twig
|
||||
|
||||
{{ opening_box|raw }}
|
||||
<div>
|
||||
{# logic for rendering #}
|
||||
</div>
|
||||
</div>
|
||||
{{ closing_box|raw }}
|
||||
```
|
||||
|
||||
## Usage in templates
|
||||
Usage in templates
|
||||
==================
|
||||
|
||||
For rendering an entity as a box:
|
||||
For rendering entity as a box:
|
||||
|
||||
`{{ entity|chill_entity_render_box }}`
|
||||
.. code-block:: twig
|
||||
|
||||
For rendering an entity as a string:
|
||||
{{ entity|chill_entity_render_box }}
|
||||
|
||||
`{{ entity|chill_entity_render_string }}`
|
||||
For rendering entity as a string:
|
||||
|
||||
## Available renderer and options
|
||||
.. code-block:: twig
|
||||
|
||||
### `Person` (Person Bundle)
|
||||
{{ entity|chill_entity_render_string }}
|
||||
|
||||
Available renderer and options
|
||||
==============================
|
||||
|
||||
:code:`Person` (Person Bundle)
|
||||
------------------------------
|
||||
|
||||
* no options
|
||||
|
||||
### `CommentEmbeddable` (Main Bundle)
|
||||
:code:`CommentEmbeddable` (Main Bundle)
|
||||
---------------------------------------
|
||||
|
||||
Options :
|
||||
Options:
|
||||
|
||||
* :code:`user`: options which will be passed to "user" renderer
|
||||
* :code:`disable_markdown`: disable markdown renderer, default to :code:`FALSE`
|
||||
* :code:`limit_lines` (integer) limit the number of lines. Default to :code:`NULL`. May be an integer.
|
||||
* :code:`metadata` (boolean): show the last updating user and last updating date. Default to :code:`TRUE`.
|
||||
|
||||
* `user`: options, which will be passed to "user" renderer
|
||||
* `disable_markdown`: disable markdown renderer, default to `FALSE`
|
||||
* `limit_lines` (integer) limit the number of lines. Default to `NULL`. Can be an integer.
|
||||
* `metadata` (boolean): show the last updating user and last updating date. Default to `TRUE`.
|
||||
@@ -1,24 +1,40 @@
|
||||
# Routing
|
||||
.. 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".
|
||||
|
||||
Our goal is to ease the installation of the different bundles. Users should not have to dive into complicated config files to install bundles.
|
||||
|
||||
## A routing loader is available for all bundles
|
||||
Routing
|
||||
#######
|
||||
|
||||
A Chill bundle may rely on the Routing Loader defined in ChillMain.
|
||||
Our goal is to ease the installation of the different bundle. Users should not have to dive into complicated config files to install bundles.
|
||||
|
||||
A routing loader available for all bundles
|
||||
===========================================
|
||||
|
||||
A Chill bundle may rely on the Routing Loader defined in ChillMain.
|
||||
|
||||
The loader will load `yml` or `xml` files. You simply have to add them into `chill_main` config
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
chill_main:
|
||||
# ... other stuff here
|
||||
routing:
|
||||
resources:
|
||||
- @ChillMyBundle/Resources/config/routing.yml
|
||||
|
||||
### Load routes automatically
|
||||
Load routes automatically
|
||||
-------------------------
|
||||
|
||||
But this forces users to modify config files. To avoid this, you may prepend config implementing the `PrependExtensionInterface` in the `YourBundleExtension` class. This is an example from **chill main** bundle :
|
||||
But this force users to modify config files. To avoid this, you may prepend config implementing the `PrependExtensionInterface` in the `YourBundleExtension` class. This is an example from **chill main** bundle :
|
||||
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
namespace Chill\MainBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@@ -33,7 +49,7 @@ But this forces users to modify config files. To avoid this, you may prepend con
|
||||
// ...
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
|
||||
//add current route to chill main
|
||||
@@ -48,4 +64,5 @@ But this forces users to modify config files. To avoid this, you may prepend con
|
||||
));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
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".
|
||||
|
||||
###### Run tests
|
||||
|
||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||
|
||||
## From chill app
|
||||
|
||||
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||
|
||||
# run into a container
|
||||
`docker-compose exec --user $(id -u) php bash`
|
||||
# execute all tests suites
|
||||
`bin/phpunit`
|
||||
# ... or execute a single test
|
||||
`bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php`
|
||||
|
||||
You can also run tests in a single command:
|
||||
|
||||
`docker-compose exec --user $(id -u) php bin/phpunit`
|
||||
|
||||
### Tests from a bundle (chill-bundles)
|
||||
|
||||
Those tests need the whole symfony app to execute Application Tests (which test html page).
|
||||
|
||||
For ease, the app is cloned using a `git submodule`, which clone the main app into `tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||
|
||||
You may boostrap the tests for the chill bundle this way:
|
||||
|
||||
# ensure to be located into the environment (provided by docker suits well)
|
||||
`docker-compose exec --user $(id -u) php bash`
|
||||
# go to chill subdirectory
|
||||
`cd vendor/chill-project/chill-bundles`
|
||||
# install submodule
|
||||
`git submodule init`
|
||||
`git submodule update`
|
||||
# install composer and dependencies
|
||||
`curl -sS https://getcomposer.org/installer | php`
|
||||
# run tests
|
||||
`bin/phpunit`
|
||||
|
||||
If you are on a fresh installation, you will need to migrate database schema.
|
||||
|
||||
The path to the console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||
|
||||
```bash
|
||||
tests/app/bin/console doctrine:migrations:migrate
|
||||
tests/app/bin/console doctrine:fixtures:load
|
||||
```
|
||||
68
docs/source/development/run-tests.rst
Normal file
68
docs/source/development/run-tests.rst
Normal file
@@ -0,0 +1,68 @@
|
||||
.. 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".
|
||||
|
||||
Run tests
|
||||
*********
|
||||
|
||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||
|
||||
From chill app
|
||||
==============
|
||||
|
||||
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# run into a container
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# execute all tests suites
|
||||
bin/phpunit
|
||||
# .. or execute a single test
|
||||
bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php
|
||||
|
||||
You can also run tests in a single command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php bin/phpunit
|
||||
|
||||
|
||||
Tests from a bundle (chill-bundles)
|
||||
-----------------------------------
|
||||
|
||||
Those tests needs the whole symfony app to execute Application Tests (which test html page).
|
||||
|
||||
For ease, the app is cloned using a :code:`git submodule`, which clone the main app into :code:`tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||
|
||||
You may boostrap the tests fro the chill bundle this way:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# ensure to be located into the environement (provided by docker suits well)
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# go to chill subdirectory
|
||||
cd vendor/chill-project/chill-bundles
|
||||
# install submodule
|
||||
git submodule init
|
||||
git submodule update
|
||||
# install composer and dependencies
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
# run tests
|
||||
bin/phpunit
|
||||
|
||||
.. note::
|
||||
|
||||
If you are on a fresh install, you will need to migrate database schema.
|
||||
|
||||
The path to console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
tests/app/bin/console doctrine:migrations:migrate
|
||||
tests/app/bin/console doctrine:fixtures:load
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
###### Searching
|
||||
|
||||
Chill should provide information needed by users when they need it. Searching within bundle, entities, ... is an important feature to achieve this goal.
|
||||
|
||||
The Main Bundle provides interfaces to ease the developer's work. It will also attempt that search will work in the same way accross bundles.
|
||||
|
||||
:local:
|
||||
|
||||
[Our blog post about searching (in French) ](http://blog.champs-libres.coop/vie-des-champs/2015/01/06/va-chercher-chill-la-recherche-dans-chill-logiciel-libre-service-social.html)
|
||||
This blog post gives some information for end-users about searching.
|
||||
|
||||
[The issue about search behaviour ](https://redmine.champs-libres.coop/issues/377)
|
||||
Where the search behavior is defined.
|
||||
|
||||
## Searching at a glance for developers
|
||||
|
||||
Chill suggests using an easy-to-learn language search.
|
||||
|
||||
We are planning to provide a form to create an automatic search pattern according to this language. Watch the [issue regarding this feature ](https://redmine.champs-libres.coop/issues/389).
|
||||
|
||||
The language is an association of search terms. Search terms may contain :
|
||||
|
||||
- **a domain**: this is "the domain you want to search": it may some entities like people, reports, ... Example: [@person` to search accross people, `@report` to browse reports, ... The search pattern may have **a maximum of one** domain by search, providing more should throw an error, and trigger a warning for users.
|
||||
- **arguments and their values** : This is "what you search." Arguments narrow the search to specific fields: username, date of birth, nationality, ... The syntax is `argument:value`. I.e.: ` birthdate:2014-12-15`, `firstname:Depardieu`, ... **Arguments are optional**. If the value of an argument contains spaces or characters like punctuation, quotes ("), the value should be provided between parenthesis : `firstname:(Van de snoeck)`, `firstname:(M'bola)`, ...
|
||||
- **default value** : this the "rest" of the search, not linked with any arguments or domain. Example : `@person dep` (`dep` is the "default value"), or simply `dep` if any domain is provided (which is perfectly acceptable). If a string is not idenfied as argument or domain, it will be present in the "default" term.
|
||||
|
||||
If a search pattern (provided by the user) does not contain any domain, the search must be run across default domain/search modules.
|
||||
|
||||
A domain may be supported by different search modules. For instance, if you provide the domain `@person`, the end-user may receive results of exact firstname/lastname, but also result with spelling suggestion, ... **But** if results do not fit into the first page (if you have 75 results and the screen show only 50 results), the next page should contains only the results from the required module.
|
||||
|
||||
For instance: a user searches across people by firstname/lastname, the exact spelling contains 10 results, the "spelling suggestion" results contain 75 names, but show only the first 50. If the user want to see the last 25, the next screen should not contains the results by firstname/lastname.
|
||||
|
||||
## Allowed characters as arguments
|
||||
|
||||
To execute regular expression, the allowed characters in arguments are a-z characters, numbers, and the sign '-'. Spaces and special characters like accents are note allowed (the accents are removed during parsing).
|
||||
|
||||
## Special characters and uppercase
|
||||
|
||||
The search should not care about lowercase/uppercase and accented characters. Currently, they are removed automatically by the `chill.main.search_provider`.
|
||||
|
||||
## Implementing a search module for dev
|
||||
|
||||
To implement a search module, you should :
|
||||
|
||||
- create a class which implements the `Chill\MainBundle\Search\SearchInterface` class. An abstract class `Chill\MainBundle\Search\AbstractSearch` will provide useful assertions for parsing date string to `DateTime` objects, ...
|
||||
- register the class as a service, and tag the service with `chill.search` and an appropriate alias
|
||||
|
||||
The search logic is provided under the `/search` route.
|
||||
|
||||
`The implementation of a search module in the Person bundle ](https://github.com/Chill-project/Person/blob/master/Search/PersonSearch.php)
|
||||
An example of implementation https://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php
|
||||
|
||||
**Internals explained** : the services tagged with [chill.search` are gathered into the `chill.main.search_provider` service during compilation (`see the compiler pass ](https://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php)).
|
||||
|
||||
The [chill.main.search_provider` service allows to :
|
||||
|
||||
- retrieve all results (as HTML string) for all search modules concerned by the search (according to the domain provided or modules marked as default)
|
||||
- retrieve result for one search module
|
||||
|
||||
### The SearchInterface class
|
||||
|
||||
```php
|
||||
namespace Chill\PersonBundle\Search;
|
||||
|
||||
use Chill\MainBundle\Search\AbstractSearch;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Chill\MainBundle\Search\ParsingException;
|
||||
|
||||
class PersonSearch extends AbstractSearch
|
||||
{
|
||||
|
||||
// indicate which domain you support
|
||||
// you may respond TRUE to multiple domain, according to your logic
|
||||
public function supports($domain, $format='html')
|
||||
{
|
||||
return 'person' === $domain;
|
||||
}
|
||||
|
||||
// if your domain must be called when no domain is provided, should return true
|
||||
public function isActiveByDefault()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if multiple modules respond to the same domain, indicate an order for your search.
|
||||
public function getOrder()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
// This is where your search logic should be executed.
|
||||
// This method must return an HTML string (a string with HTML tags)
|
||||
// see below about the structure of the $term array
|
||||
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = array(), $format = 'html')
|
||||
{
|
||||
return $this->container->get('templating')->render('ChillPersonBundle:Person:list.html.twig',
|
||||
array(
|
||||
// you should implement the `search` function somewhere :-)
|
||||
'persons' => $this->search($terms, $start, $limit, $options),
|
||||
// recomposePattern is available in AbstractSearch class
|
||||
'pattern' => $this->recomposePattern($terms, array('nationality',
|
||||
'firstname', 'lastname', 'birthdate', 'gender'), $terms['_domain']),
|
||||
// you should implement the `count` function somewhere :-)
|
||||
'total' => $this->count($terms)
|
||||
));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Values for `$options`
|
||||
|
||||
`$options` is an array with the following keys:
|
||||
|
||||
- `SearchInterface::SEARCH_PREVIEW_OPTION` (bool): if the current view is a preview (the first 5 results) or not ;
|
||||
- `SearchInterface::REQUEST_QUERY_PARAMETERS` (bool): some parameters added to the query (under the key `SearchInterface::REQUEST_QUERY_KEY_ADD_PARAMETERS`) and that can be interpreted. Used, for instance, when calling a result in json format when searching for interactive picker form.
|
||||
|
||||
##### Structure of array `$term`
|
||||
|
||||
The array term is parsed automatically by the `main.chill.search_provider` service.
|
||||
|
||||
If you need to parse a search pattern, you may use the function `parse($pattern)` provided by the service.
|
||||
|
||||
The array `$term` have the following structure after parsing :
|
||||
|
||||
```php
|
||||
array(
|
||||
'_domain' => 'person', //the domain, without the '@'
|
||||
'argument1' => 'value', //the argument1, with his value
|
||||
'argument2' => 'my value with spaces', //the argument2
|
||||
'_default' => 'abcde ef' // the default term
|
||||
);
|
||||
```
|
||||
|
||||
The original search would have been : `@person argument1:value argument2:(my value with spaces) abcde ef`
|
||||
|
||||
The search values are always unaccented.
|
||||
|
||||
##### Returning a result in JSON
|
||||
|
||||
The JSON format is mainly used by "select2" widgets.
|
||||
|
||||
When returning a result in JSON, the SearchInterface should only return an array with following keys:
|
||||
|
||||
- `more` (bool): if the search has more result than the current page ;
|
||||
- `results` (array): a list of a result, where:
|
||||
|
||||
- `text` (string): the text that should be displayed in browser ;
|
||||
- `id` (string): the id of the entity.
|
||||
|
||||
### Register the service
|
||||
|
||||
You should add your service in the configuration, and add a `chill.search` tag and an alias.
|
||||
|
||||
Example :
|
||||
|
||||
```yaml
|
||||
services:
|
||||
chill.person.search_person:
|
||||
class: Chill\PersonBundle\Search\PersonSearch
|
||||
#your logic here
|
||||
tags:
|
||||
- { name: chill.search, alias: 'person_regular' }
|
||||
```
|
||||
|
||||
The alias will be used to get the results narrowed to this search module, in case of pagination (see above).
|
||||
|
||||
## Parsing date
|
||||
|
||||
The class `Chill\MainBundle\Search\AbstractSearch` provides a method to parse date :
|
||||
|
||||
//from subclasses
|
||||
`$date = $this->parseDate($string);`
|
||||
|
||||
`$date` will be an instance of `DateTime ](http://php.net/manual/en/class.datetime.php).
|
||||
|
||||
[The possibility to add periods instead of date ](https://redmine.champs-libres.coop/issues/390)
|
||||
Which may be a future improvement for search with date.
|
||||
|
||||
## Exceptions
|
||||
|
||||
The logic of the search is handled by the controller for the `/search` path.
|
||||
|
||||
You should throw those Exceptions from your instance of `SearchInterface` if needed :
|
||||
|
||||
Chill\MainBundle\Search\ParsingException
|
||||
If the terms do not fit your search logic (for instance, conflicting terms)
|
||||
|
||||
## Expected behaviour
|
||||
|
||||
### Operators between multiple terms
|
||||
|
||||
Multiple terms should be considered are "AND" instructions :
|
||||
|
||||
@person nationality:RU firstname:dep
|
||||
the people having the Russian nationality AND having DEP in their name
|
||||
|
||||
@person birthdate:2015-12-12 charles
|
||||
the people having 'charles' in their name or firstname AND born on December 12, 2015
|
||||
|
||||
### Spaces in default
|
||||
|
||||
Spaces in default terms should be considered as "AND" instruction
|
||||
|
||||
@person charle dep
|
||||
people have "dep" AND "charles" in their firstname or lastname. Match "Charles Depardieu" but not "Gérard Depardieu" ('charle' is not present)
|
||||
|
||||
### Rendering
|
||||
|
||||
The rendering should contain :
|
||||
|
||||
- the total number of results ;
|
||||
- the search pattern in the search language. The aim of this is to let users learn the search language easily.
|
||||
- a title
|
||||
|
||||
## Frequently Asked Questions (FAQ)
|
||||
|
||||
Why does renderResults return an HTML string and not a structured array?
|
||||
It seems that the form of results may vary (according to access-right logic, ...) and is not easily structurable
|
||||
276
docs/source/development/searching.rst
Normal file
276
docs/source/development/searching.rst
Normal file
@@ -0,0 +1,276 @@
|
||||
.. 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".
|
||||
|
||||
|
||||
Searching
|
||||
*********
|
||||
|
||||
Chill should provide information needed by users when they need it. Searching within bundle, entities,... is an important feature to achieve this goal.
|
||||
|
||||
The Main Bundle provide interfaces to ease the developer work. It will also attempt that search will work in the same way accross bundles.
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Our blog post about searching (in French) <http://blog.champs-libres.coop/vie-des-champs/2015/01/06/va-chercher-chill-la-recherche-dans-chill-logiciel-libre-service-social.html>`_
|
||||
This blog post give some information for end-users about searching.
|
||||
|
||||
`The issue about search behaviour <https://redmine.champs-libres.coop/issues/377>`_
|
||||
Where the search behaviour is defined.
|
||||
|
||||
Searching in a glance for developers
|
||||
====================================
|
||||
|
||||
Chill suggests to use an easy-to-learn language search.
|
||||
|
||||
.. note::
|
||||
|
||||
We are planning to provide a form to create automatically search pattern according to this language. Watch the `issue regarding this feature <https://redmine.champs-libres.coop/issues/389>`_.
|
||||
|
||||
The language is an association of search terms. Search terms may contains :
|
||||
|
||||
- **a domain**: this is "the domain you want to search" : it may some entities like people, reports, ... Example : `@person` to search accross people, `@report` to browse reports, ... The search pattern may have **a maximum of one** domain by search, providing more should throw an error, and trigger a warning for users.
|
||||
- **arguments and their values** : This is "what you search". Arguments narrow the search to specific fields : username, date of birth, nationality, ... The syntax is `argument:value`. I.e.: ` birthdate:2014-12-15`, `firstname:Depardieu`, ... **Arguments are optional**. If the value of an argument contains spaces or characters like punctuation, quotes ("), the value should be provided between parenthesis : `firstname:(Van de snoeck)`, `firstname:(M'bola)`, ...
|
||||
- **default value** : this the "rest" of the search, not linked with any arguments or domain. Example : `@person dep` (`dep` is the "default value"), or simply `dep` if any domain is provided (which is perfectly acceptable). If a string is not idenfied as argument or domain, it will be present in the "default" term.
|
||||
|
||||
If a search pattern (provided by the user) does not contains any domain, the search must be run across default domain/search modules.
|
||||
|
||||
A domain may be supported by different search modules. For instance, if you provide the domain `@person`, the end-user may receive results of exact firstname/lastname, but also result with spelling suggestion, ... **But** if results do not fit into the first page (if you have 75 results and the screen show only 50 results), the next page should contains only the results from the required module.
|
||||
|
||||
For instance : a user search across people by firstname/lastname, the exact spelling contains 10 results, the "spelling suggestion" results contains 75 names, but show only the first 50. If the user want to see the last 25, the next screen should not contains the results by firstname/lastname.
|
||||
|
||||
Allowed characters as arguments
|
||||
===============================
|
||||
|
||||
In order to execute regular expression, the allowed chararcters in arguments are a-z characters, numbers, and the sign '-'. Spaces and special characters like accents are note allowed (the accents are removed during parsing).
|
||||
|
||||
Special characters and uppercase
|
||||
================================
|
||||
|
||||
The search should not care about lowercase/uppercase and accentued characters. Currently, they are removed automatically by the `chill.main.search_provider`.
|
||||
|
||||
Implementing search module for dev
|
||||
===================================
|
||||
|
||||
To implement a search module, you should :
|
||||
|
||||
- create a class which implements the `Chill\MainBundle\Search\SearchInterface` class. An abstract class `Chill\MainBundle\Search\AbstractSearch` will provide useful assertions for parsing date string to `DateTime` objects, ...
|
||||
- register the class as a service, and tag the service with `chill.search` and an appropriate alias
|
||||
|
||||
The search logic is provided under the `/search` route.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The implementation of a search module in Person bundle <https://github.com/Chill-project/Person/blob/master/Search/PersonSearch.php>`_
|
||||
An example of implementationhttps://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php
|
||||
|
||||
.. note::
|
||||
|
||||
**Internals explained** : the services tagged with `chill.search` are gathered into the `chill.main.search_provider` service during compilation (`see the compiler pass <https://github.com/Chill-project/Main/blob/master/DependencyInjection/SearchableServicesCompilerPass.php>`_).
|
||||
|
||||
The `chill.main.search_provider` service allow to :
|
||||
|
||||
- retrieve all results (as html string) for all search module concerned by the search (according to the domain provided or modules marked as default)
|
||||
- retrieve result for one search module
|
||||
|
||||
The SearchInterface class
|
||||
-------------------------
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Search;
|
||||
|
||||
use Chill\MainBundle\Search\AbstractSearch;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Chill\MainBundle\Search\ParsingException;
|
||||
|
||||
class PersonSearch extends AbstractSearch
|
||||
{
|
||||
|
||||
// indicate which domain you support
|
||||
// you may respond TRUE to multiple domain, according to your logic
|
||||
public function supports($domain, $format='html')
|
||||
{
|
||||
return 'person' === $domain;
|
||||
}
|
||||
|
||||
// if your domain must be called when no domain is provided, should return true
|
||||
public function isActiveByDefault()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if multiple module respond to the same domain, indicate an order for your search.
|
||||
public function getOrder()
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
|
||||
// This is where your search logic should be executed.
|
||||
// This method must return an HTML string (a string with HTML tags)
|
||||
// see below about the structure of the $term array
|
||||
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = array(), $format = 'html')
|
||||
{
|
||||
return $this->container->get('templating')->render('ChillPersonBundle:Person:list.html.twig',
|
||||
array(
|
||||
// you should implements the `search` function somewhere :-)
|
||||
'persons' => $this->search($terms, $start, $limit, $options),
|
||||
// recomposePattern is available in AbstractSearch class
|
||||
'pattern' => $this->recomposePattern($terms, array('nationality',
|
||||
'firstname', 'lastname', 'birthdate', 'gender'), $terms['_domain']),
|
||||
// you should implement the `count` function somewhere :-)
|
||||
'total' => $this->count($terms)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Values for :code:`$options`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
:code:`$options` is an array with the following keys:
|
||||
|
||||
- :code:`SearchInterface::SEARCH_PREVIEW_OPTION` (bool): if the current view is a preview (the first 5 results) or not ;
|
||||
- :code:`SearchInterface::REQUEST_QUERY_PARAMETERS` (bool): some parameters added to the query (under the key :code:`SearchInterface::REQUEST_QUERY_KEY_ADD_PARAMETERS`) and that can be interpreted. Used, for instance, when calling a result in json format when searching for interactive picker form.
|
||||
|
||||
|
||||
|
||||
|
||||
Structure of array `$term`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The array term is parsed automatically by the `main.chill.search_provider` service.
|
||||
|
||||
.. note::
|
||||
If you need to parse a search pattern, you may use the function `parse($pattern)` provided by the service.
|
||||
|
||||
The array `$term` have the following structure after parsing :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'_domain' => 'person', //the domain, without the '@'
|
||||
'argument1' => 'value', //the argument1, with his value
|
||||
'argument2' => 'my value with spaces', //the argument2
|
||||
'_default' => 'abcde ef' // the default term
|
||||
);
|
||||
|
||||
The original search would have been : `@person argument1:value argument2:(my value with spaces) abcde ef`
|
||||
|
||||
.. warning::
|
||||
The search values are always unaccented.
|
||||
|
||||
Returning a result in json
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The json format is mainly used by "select2" widgets.
|
||||
|
||||
When returning a result in json, the SearchInterface should only return an array with following keys:
|
||||
|
||||
- :code:`more` (bool): if the search has more result than the current page ;
|
||||
- :code:`results` (array): a list of result, where:
|
||||
|
||||
- :code:`text` (string): the text that should be displayed in browser ;
|
||||
- :code:`id` (string): the id of the entity.
|
||||
|
||||
|
||||
|
||||
Register the service
|
||||
--------------------
|
||||
|
||||
You should add your service in the configuration, and add a `chill.search` tag and an alias.
|
||||
|
||||
Example :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
services:
|
||||
chill.person.search_person:
|
||||
class: Chill\PersonBundle\Search\PersonSearch
|
||||
#your logic here
|
||||
tags:
|
||||
- { name: chill.search, alias: 'person_regular' }
|
||||
|
||||
The alias will be used to get the results narrowed to this search module, in case of pagination (see above).
|
||||
|
||||
Parsing date
|
||||
============
|
||||
|
||||
The class `Chill\MainBundle\Search\AbstractSearch` provides a method to parse date :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
//from subclasses
|
||||
$date = $this->parseDate($string);
|
||||
|
||||
`$date` will be an instance of `DateTime <http://php.net/manual/en/class.datetime.php>`_.
|
||||
|
||||
.. seealso::
|
||||
|
||||
`The possibility to add periods instead of date <https://redmine.champs-libres.coop/issues/390>`_
|
||||
Which may be a future improvement for search with date.
|
||||
|
||||
Exceptions
|
||||
==========
|
||||
|
||||
The logic of the search is handled by the controller for the `/search` path.
|
||||
|
||||
You should throw those Exception from your instance of `SearchInterface` if needed :
|
||||
|
||||
Chill\MainBundle\Search\ParsingException
|
||||
If the terms does not fit your search logic (for instance, conflicting terms)
|
||||
|
||||
Expected behaviour
|
||||
==================
|
||||
|
||||
Operators between multiple terms
|
||||
--------------------------------
|
||||
|
||||
Multiple terms should be considered are "AND" instructions :
|
||||
|
||||
@person nationality:RU firstname:dep
|
||||
the people having the Russian nationality AND having DEP in their name
|
||||
|
||||
@person birthdate:2015-12-12 charles
|
||||
the people having 'charles' in their name or firstname AND born on December 12 2015
|
||||
|
||||
Spaces in default
|
||||
-----------------
|
||||
|
||||
Spaces in default terms should be considered as "AND" instruction
|
||||
|
||||
@person charle dep
|
||||
people having "dep" AND "charles" in their firstname or lastname. Match "Charles Depardieu" but not "Gérard Depardieu" ('charle' is not present)
|
||||
|
||||
Rendering
|
||||
---------
|
||||
|
||||
The rendering should contains :
|
||||
|
||||
- the total number of results ;
|
||||
- the search pattern in the search language. The aim of this is to let users learn the search language easily.
|
||||
- a title
|
||||
|
||||
Frequently Asked Questions (FAQ)
|
||||
================================
|
||||
|
||||
Why renderResults returns an HTML string and not structured array ?
|
||||
It seems that the form of results may vary (according to access-right logic, ...) and is not easily structurable
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,49 @@
|
||||
###### Timelines
|
||||
.. Copyright (C) 2015 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".
|
||||
|
||||
.. _timelines:
|
||||
|
||||
Timelines
|
||||
*********
|
||||
|
||||
.. contents:: Table of content
|
||||
:local:
|
||||
|
||||
## Concept
|
||||
Concept
|
||||
=======
|
||||
|
||||
### From a user point of view
|
||||
From an user point of view
|
||||
--------------------------
|
||||
|
||||
Chill has two goals :
|
||||
Chill has two objectives :
|
||||
|
||||
* it makes the administrative tasks more lightweight ;
|
||||
* make the administrative tasks more lightweight ;
|
||||
* help social workers to have all information they need to work
|
||||
|
||||
To reach this second goal, Chill provides a special view: **timeline**. On a timeline view, information is gathered and shown on a single page, from the most recent event to the oldest one.
|
||||
To reach this second objective, Chill provides a special view: **timeline**. On a timeline view, information is gathered and shown on a single page, from the most recent event to the oldest one.
|
||||
|
||||
The information gathered is linked to a *context*. This *context* may be, for instance :
|
||||
|
||||
* a person: events linked to this person are shown on the page ;
|
||||
* a person : events linked to this person are shown on the page ;
|
||||
* a center: events linked to a center are shown. They may concern different peoples ;
|
||||
* ...
|
||||
|
||||
In another word, the *context* is the kind of argument that will be used in the event's query.
|
||||
In other word, the *context* is the kind of argument that will be used in the event's query.
|
||||
|
||||
Let us recall that only the data the user has allowed to see should be shown.
|
||||
|
||||
[The issue where the subject was first discussed ](https://redmine.champs-libres.coop/issues/224)
|
||||
.. seealso::
|
||||
|
||||
### For developers
|
||||
`The issue where the subject was first discussed <https://redmine.champs-libres.coop/issues/224>`_
|
||||
|
||||
|
||||
For developers
|
||||
--------------
|
||||
|
||||
The `Main` bundle provides interfaces and services to help to build timelines.
|
||||
|
||||
@@ -33,38 +51,45 @@ If a bundle wants to *push* information in a timeline, it should be create a ser
|
||||
|
||||
If a bundle wants to provide a new context for a timeline, the service `chill.main.timeline_builder` will helps to gather timeline's services supporting the defined context, and run queries across the models.
|
||||
|
||||
##### Understanding queries
|
||||
.. _understanding-queries :
|
||||
|
||||
Understanding queries
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Due to the fact that timelines should show only the X last events from Y differents tables, queries for a timeline may consume a lot of resources: at first on the database, and then on the ORM part, which will have to deserialize DB data to PHP classes, which may not be used if they are not part of the "last X events".
|
||||
|
||||
To avoid such a load on a database, the objects are queried in two steps :
|
||||
To avoid such load on database, the objects are queried in two steps :
|
||||
|
||||
1. A UNION request that gathers the last X events, ordered by date. The data retrieved are the ID, the date, and a string key: a type. This type discriminates the data type.
|
||||
2. ID queries the PHP objects, the type helps the program to link id with the kind of objects.
|
||||
1. An UNION request which gather the last X events, ordered by date. The data retrieved are the ID, the date, and a string key: a type. This type discriminates the data type.
|
||||
2. The PHP objects are queried by ID, the type helps the program to link id with the kind of objects.
|
||||
|
||||
Those methods should ensure that only X PHP objects will be gathered and built by the ORM.
|
||||
Those methods should ensure that only X PHP objects will be gathered and build by the ORM.
|
||||
|
||||
##### What does the master timeline builder service?
|
||||
What does the master timeline builder service ?
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When the service `chill.main.timeline_builder` is instanciated, the service is informed of each service taggued with `chill.timeline` tags. Then,
|
||||
|
||||
1. The service build an UNION query by assembling column and tables names provided by the `fetchQuery` result ;
|
||||
2. The UNION query is run, the result contains an id and a type for each row (see [above ](understanding-queries.md))
|
||||
2. The UNION query is run, the result contains an id and a type for each row (see :ref:`above <understanding-queries>`)
|
||||
3. The master service gather all id with the same type. Then he searches for the `chill.timeline`'s service which will be able to get the entities. Then, the entities will be fetched using the `fetchEntities` function. All entities are gathered in one query ;
|
||||
4. The information to render entities in HTML is gathered by passing entity, one by one, on `getEntityTemplate` function.
|
||||
|
||||
## Pushing events to a timeline
|
||||
Pushing events to a timeline
|
||||
=============================
|
||||
|
||||
To push events on a timeline :
|
||||
|
||||
1. Create a class which implements `Chill\MainBundle\Timeline\TimelineProviderInterface` ;
|
||||
2. Define the class as a service, and tag the service with `chill.timeline`, and define the context associated with this timeline (you may add multiple tags for different contexts).
|
||||
|
||||
### Implementing the TimelineProviderInterface
|
||||
Implementing the TimelineProviderInterface
|
||||
------------------------------------------
|
||||
|
||||
The has the following signature :
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MainBundle\Timeline;
|
||||
|
||||
interface TimelineProviderInterface
|
||||
@@ -110,6 +135,7 @@ The has the following signature :
|
||||
* - `template` : the template FQDN
|
||||
* - `template_data`: the data required by the template
|
||||
*
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
@@ -134,42 +160,51 @@ The has the following signature :
|
||||
public function getEntityTemplate($entity, $context, array $args);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
##### The `fetchQuery` function
|
||||
|
||||
The fetchQuery function helps to build the UNION query to gather events. This function should return an instance of `TimelineSingleQuery`. For you convenience, this object may be build using an associative array with the following keys:
|
||||
The `fetchQuery` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The fetchQuery function help to build the UNION query to gather events. This function should return an instance of :code:`TimelineSingleQuery`. For you convenience, this object may be build using an associative array with the following keys:
|
||||
|
||||
* `id` : the name of the id column
|
||||
* `type`: a string to indicate the type
|
||||
* `date`: the name of the datetime column, used to order entities by date
|
||||
* `FROM`: the FROM clause. May contain JOIN instructions
|
||||
* `FROM`: the FROM clause. May contains JOIN instructions
|
||||
* `WHERE`: the WHERE clause;
|
||||
* `parameters`: the parameters to pass to the query
|
||||
|
||||
The parameters should be replaced into the query by `?`. They will be replaced into the query using prepared statements.
|
||||
The parameters should be replaced into the query by :code:`?`. They will be replaced into the query using prepared statements.
|
||||
|
||||
`$context` and `$args` are defined by the bundle which will call the timeline rendering. You may use them to build a different query depending on this context.
|
||||
|
||||
For instance, if the context is `'person'`, the args will be this array :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'person' => $person //a \Chill\PersonBundle\Entity\Person entity
|
||||
);
|
||||
|
||||
For the context `center`, the args will be:
|
||||
For the context :code:`center`, the args will be:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'centers' => [ ] // an array of \Chill\MainBundle\Entity\Center entities
|
||||
);
|
||||
|
||||
|
||||
You should find in the bundle documentation which contexts are arguments the bundle defines.
|
||||
|
||||
.. note::
|
||||
|
||||
We encourage to use `ClassMetaData` to define column names arguments. If you change your column names, changes will be reflected automatically during the execution of your code.
|
||||
|
||||
Example of an implementation :
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
@@ -215,16 +250,19 @@ Example of an implementation :
|
||||
|
||||
//....
|
||||
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
##### The `supportsType` function
|
||||
The `supportsType` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function indicates to the master `chill.main.timeline_builder` service (which orchestrate the build of UNION queries) that the service supports the type indicated in the result's array of the `fetchQuery` function.
|
||||
This function indicate to the master `chill.main.timeline_builder` service (which orchestrate the build of UNION queries) that the service supports the type indicated in the result's array of the `fetchQuery` function.
|
||||
|
||||
The implementation of our previous example will be :
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
@@ -246,15 +284,16 @@ The implementation of our previous example will be :
|
||||
|
||||
//...
|
||||
}
|
||||
```
|
||||
|
||||
##### The `getEntities` function
|
||||
The `getEntities` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is where the service must fetch entities from database and return them to the master service.
|
||||
|
||||
The results **must be** an array where the id given by the UNION query (remember `fetchQuery`).
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\ReportBundle\Timeline;
|
||||
|
||||
use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
@@ -277,9 +316,9 @@ The results **must be** an array where the id given by the UNION query (remember
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
##### The `getEntityTemplate` function
|
||||
The `getEntityTemplate` function
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This is where the master service will collect information to render the entity.
|
||||
|
||||
@@ -290,7 +329,8 @@ The result must be an associative array with :
|
||||
|
||||
Example :
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
array(
|
||||
'template' => 'ChillMyBundle:timeline:template.html.twig',
|
||||
'template_data' => array(
|
||||
@@ -298,19 +338,23 @@ Example :
|
||||
'person' => $args['person']
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
The template must exist. Example :
|
||||
The template must, obviously, exists. Example :
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
<p><i class="fa fa-folder-open"></i> {{ 'An accompanying period is opened for %person% on %date%'|trans({'%person%': person, '%date%': period.dateOpening|localizeddate('long', 'none') } ) }}</p>
|
||||
|
||||
## Create a timeline with his own context
|
||||
|
||||
Create a timeline with his own context
|
||||
======================================
|
||||
|
||||
You have to create a Controller which will execute the service `chill.main.timeline_builder`. Using the `Chill\MainBundle\Timeline\TimelineBuilder::getTimelineHTML` function, you will get an HTML representation of the timeline, which you may include with twig `raw` filter.
|
||||
|
||||
Example :
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -340,4 +384,3 @@ Example :
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
@@ -1,17 +1,26 @@
|
||||
# Useful snippets
|
||||
|
||||
###### Dependency Injection
|
||||
|
||||
## Configure route automatically
|
||||
|
||||
|
||||
Useful snippets
|
||||
###############
|
||||
|
||||
Dependency Injection
|
||||
********************
|
||||
|
||||
Configure route automatically
|
||||
=============================
|
||||
|
||||
Add the route for the current bundle automatically on the main app.
|
||||
|
||||
```php
|
||||
.. code-block:: php
|
||||
|
||||
namespace Chill\MyBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
|
||||
|
||||
class ChillMyExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
// ...
|
||||
@@ -21,8 +30,8 @@ Add the route for the current bundle automatically on the main app.
|
||||
$this->prependRoutes($container);
|
||||
|
||||
}
|
||||
|
||||
public function prependRoutes(ContainerBuilder $container)
|
||||
|
||||
public function prependRoutes(ContainerBuilder $container)
|
||||
{
|
||||
//add routes for custom bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
@@ -33,26 +42,32 @@ Add the route for the current bundle automatically on the main app.
|
||||
)
|
||||
));
|
||||
}
|
||||
```
|
||||
|
||||
###### Security
|
||||
|
||||
## Get the circles a user can reach
|
||||
Security
|
||||
********
|
||||
|
||||
Get the circles a user can reach
|
||||
================================
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
```php
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
$authorizationHelper = $this->get('chill.main.security.authorization.helper');
|
||||
$circles = $authorizationHelper
|
||||
->getReachableCircles(
|
||||
$this->getUser(), # from a controller
|
||||
new Role('CHILL_ROLE'),
|
||||
$center
|
||||
new Role('CHILL_ROLE'),
|
||||
$center
|
||||
);
|
||||
```
|
||||
|
||||
###### Controller
|
||||
|
||||
## Secured controller for person
|
||||
Controller
|
||||
**********
|
||||
|
||||
[controller](useful-snippets/controller-secured-for-person.php)
|
||||
Secured controller for person
|
||||
=============================
|
||||
|
||||
.. literalinclude:: useful-snippets/controller-secured-for-person.php
|
||||
:language: php
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user