Compare commits

..

2 Commits

Author SHA1 Message Date
90d3bf32e6 fix date formatting and parsing logic
- Support time formatting in `formatDate` with `time` option.
- Improve parsing in `ISOToDate` to handle time information or date-only strings.
2025-08-11 15:52:22 +02:00
ebc2921696 Add 45 and 60 minute calendar ranges 2025-08-11 15:23:01 +02:00
478 changed files with 6162 additions and 15874 deletions

View File

@@ -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

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Show filters on list pages unfolded by default
time: 2025-07-22T15:50:39.338057044+02:00
custom:
Issue: "399"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Add 45 and 60 min calendar ranges
time: 2025-08-11T15:21:54.209009751+02:00
custom:
Issue: "409"
SchemaChange: No schema change

View File

@@ -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

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: adjust display logic for accompanying period dates, include closing date if period is closed.
time: 2025-08-06T13:46:09.241584292+02:00
custom:
Issue: "382"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: add min and step attributes to integer field in DateIntervalType
time: 2025-08-06T17:35:27.413787704+02:00
custom:
Issue: "384"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: fix date formatting in calendar range display
time: 2025-08-11T15:52:12.949078671+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,6 @@
kind: UX
body: Limit display of participations in event list
time: 2025-07-22T13:26:37.500656935+02:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@@ -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

View File

@@ -1,12 +0,0 @@
## 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
**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
### UX
* Limit display of participations in event list

View File

@@ -1,10 +0,0 @@
## v4.2.0 - 2025-09-02
### Feature
* ([#64](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/64)) Add external identifier for a Person
**Schema Change**: Add columns or tables
* ([#330](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/330) Allow users to choose for which notifications they want to receive an email
### Fixed
* ([#422](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/422)) Fixed html layout of pages for recovering password
* Fix typo in 'uncheckAll' script for centers selection
* Fix incorrect parameter name in event details link

View File

@@ -1,6 +0,0 @@
## v4.2.1 - 2025-09-03
### Fixed
* Fix exports to work with DirectExportInterface
### DX
* Improve error message when a stored object cannot be written on local disk

View File

@@ -1,10 +0,0 @@
## 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
**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

View File

@@ -1,8 +0,0 @@
## 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
### Fixed
* Fix display of 'duplicate' and 'merge' buttons in CRUD templates
* Fix saving notification preferences in user's profile

View File

@@ -1,3 +0,0 @@
## v4.4.1 - 2025-09-11
### Fixed
* fix translations in duplicate evaluation document modal and realign close modal button

View File

@@ -1,3 +0,0 @@
## v4.4.2 - 2025-09-12
### Fixed
* Fix document generation and workflow generation do not work on accompanying period work documents

View File

@@ -1,13 +0,0 @@
## 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
### 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
### DX
* Introduce a WaitingScreen component to display a waiting screen

View File

@@ -1,4 +0,0 @@
## 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

View File

@@ -1,14 +0,0 @@
## v4.6.0 - 2025-10-15
### Feature
* ([#423](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/423)) Create environment banner that can be activated and configured depending on the image deployed
* ([#394](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/394)) Only show active workflow on the page "my tracked workflow"
### Fixed
* Fix loading of classLists in SocialIssuesAcc.vue, ensure elements are present
* Fix the rendering of list of StoredObjectVersions, where there are kept version (before converting to pdf) and intermediate versions deleted
* ([#434](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/434)) Notification: fix editing of sent notification by removing form.addressesEmails, a field that no longer exists
* Fix loading of social issues and social actions within vue component
* ([#446](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/446)) Add unique condition on stored object filename, with cleaning step on existing duplicate filenames
**Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed
* [workflow] take permissions into account to delete the workflow attachment
* ([#448](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/448)) Fix the execution of daily cronjob notification, when the previous last execution storage was invalid

View File

@@ -1,3 +0,0 @@
## v4.6.1 - 2025-10-27
### Fixed
* Fix export case where no 'reason' is picked within the PersonHavingActivityBetweenDateFilter.php

View File

@@ -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

View File

@@ -7,6 +7,14 @@
"message": "'app' is assigned a value but never used.",
"hash": "f8c2979921289906e3baabae31ba101ead91504f"
},
{
"path": "src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js",
"line": 57,
"column": 23,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'event' is defined but never used.",
"hash": "cf0cf378f71403f62a6425f384ccbbdec433d1f2"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js",
"line": 7,
@@ -119,6 +127,46 @@
"message": "'payload' is defined but never used.",
"hash": "66c545917093ba30f1d6ca10ddaa676140e749bd"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue",
"line": 224,
"column": 10,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reactive' is defined but never used.",
"hash": "96ed76a9828138fb125fc36c4b55e900bbfe87c2"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue",
"line": 230,
"column": 5,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'DropArg' is defined but never used.",
"hash": "bd405399a4091d65e8391404bfb0c4611816c8e0"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue",
"line": 251,
"column": 9,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'t' is assigned a value but never used.",
"hash": "bc09207a496405f7a71c178e522b89aeb1f7ebd3"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue",
"line": 356,
"column": 32,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'arg' is defined but never used.",
"hash": "aeae152f0669b946a1ad681dd52b0ef03393ae79"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue",
"line": 434,
"column": 11,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'changedEvent' is assigned a value but never used.",
"hash": "a7a81a6bf09d00c0364e3aa8207ffad853f0547b"
},
{
"path": "src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/Components/EditLocation.vue",
"line": 77,
@@ -351,6 +399,14 @@
"message": "'error' is defined but never used.",
"hash": "e26e5e101e90d2b7ee84d6f5de8c819e52129c17"
},
{
"path": "src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts",
"line": 29,
"column": 14,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'vm' is defined but never used.",
"hash": "8e7f5e89dd72c54459cf82156389b88988f97d63"
},
{
"path": "src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/uploader.js",
"line": 39,
@@ -559,6 +615,14 @@
"message": "'ref' is defined but never used.",
"hash": "2a27cd6d06a26e1326654c929068e3704137e24b"
},
{
"path": "src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue",
"line": 57,
"column": 17,
"ruleId": "vue/valid-v-for",
"message": "Custom elements in iteration require 'v-bind:key' directives.",
"hash": "cce787939524e83dd135869e13738ef332d7156c"
},
{
"path": "src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/WopiEditButton.vue",
"line": 15,
@@ -919,6 +983,22 @@
"message": "'_e' is defined but never used.",
"hash": "1d6448401778e8c56554020fe5abd47851ed33f3"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/module/wopi-link/index.js",
"line": 21,
"column": 55,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'e' is defined but never used.",
"hash": "eae499e4f6e9f43a9d17f9cd917cb6d3d97be25c"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/page/export/download-export.js",
"line": 3,
"column": 55,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'e' is defined but never used.",
"hash": "088fd383e7807e484aefc9825209bc7c8942bd22"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/page/homepage_widget/index.js",
"line": 9,
@@ -1009,19 +1089,115 @@
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 516,
"column": 21,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"context\" prop.",
"hash": "984c4203f2ac1e1bb65f9ce76ecd03b763cfaa83"
"line": 247,
"column": 5,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'postAddressToPerson' is defined but never used.",
"hash": "8a41c437cf2b5554cbbe1704cd51f3102b3d5994"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 517,
"line": 248,
"column": 5,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'postAddressToHousehold' is defined but never used.",
"hash": "66dec84b2ece299daf21308e5e60d497ba442b27"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 490,
"column": 21,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"context\" prop.",
"hash": "c9fb019bc21bfa77d989ed596913b99dd653c594"
"hash": "0d3f40c47974a4371072b3b9ee04b197c830162d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 491,
"column": 21,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"context\" prop.",
"hash": "8e877b7e588c30e182f7b572bdb9685360f9cf99"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 508,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "5a3e3401bc3c765d91faaf4cfde57697af1262b7"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 525,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "35a741d90379574b9323279f5802193d0c98a9dc"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 553,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "c23d1ddf6c0d10ae97948e74aee9c14b9320b86c"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 572,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "4322e81c6ea9d9734c680633a724d5bd4fabacb2"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 803,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "7928a6461b9d394c7d97f048933553936f7d8963"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue",
"line": 852,
"column": 47,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "e5afdb8efccb5470a08dde48f755b1268fa947b5"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 93,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "68f5e1cf5c03f9ada59c9e0afca0b74c7f3fca4b"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 101,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "50d730f6109092baff2db66adc44dc1315e2bda2"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 109,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "573e4c041ce663f28b933d7a675c2a525aba644c"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 117,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "293f845eeab515b1df4649d136c2d8219ed59c4d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
@@ -1048,180 +1224,204 @@
"hash": "2d5a5e680ff207ad97c7e7b7d999064b561dfd8a"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 149,
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 106,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "e4c1ecd7ae77d46ac3625c5bbe92a24d6a964db9"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 157,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "4dece2db87c6ce1c04ae06c088ddfe916c1c0c61"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 165,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "facc7a0f17bdf19396fae3d0de3da82e60503c0d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressMore.vue",
"line": 173,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "19de32c76518387218264d7c4dab914d143a9cca"
"hash": "d52356f2af31d0167c02330ec22d09fbfa6b2b9f"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 130,
"line": 114,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "239ac02a02694d5b20ab30d4c7ce5838c51d1515"
"hash": "c8e8e06f370f93bf05867e93b5f037dfa46937b1"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 138,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "a54f9bc6d1edfa4df93c7dd7d409cfef3fccf99e"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 152,
"line": 128,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "74a5f664d18f3916ea908897fcd0291cb0128f29"
"hash": "9abaf71ca4b4f292b3b01e724d0a7733365e71f1"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 129,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "0b0743959778a9e3d93089b132608816ee4e6646"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 132,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "9759da7b7859b8ee8efaf74876430658ac6b6fe2"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 133,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "dba8be9a27ab74ec743b7d9e07c05d857b407dd3"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 134,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "9b1f5bce779aafc46b19d7a5d266eaa29f8f9be9"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 139,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "fe6fc4aea0994ba9da15b7c09d308842b67958cb"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 153,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "740ea5d793c7a34c9f352d8b333f3aa04cc80ee8"
"column": 55,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "bd0e024fcad2e3f4566f15293e3c25c840f6dd3e"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 156,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "af8aca18f0226a5988ed90d44d95e2d607bfb5e6"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 157,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "7bc2453017793ae20cd6c10005f941d384b59d84"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 158,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "571b4ee5f22358dd165ec59696bb3439b7c9ff6c"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 163,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "cfcb5946c86e289fc61623a794284a5a272d02e8"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 178,
"line": 154,
"column": 37,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "0ec402e43cb08bf129e0737c0d2c4f6d0c7af8bd"
"hash": "596c4b180b926b7829f987384328bf5636cd367a"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 196,
"line": 171,
"column": 59,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "5b41d5f9b45da074fb7bbbbd45e0da501da72071"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 172,
"column": 41,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "ec178d33e067aac892e015002afb6f3a2ff98762"
"hash": "d92b92a25043244cca809bd129633b7e024e26b4"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 214,
"line": 190,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "c0f4e5454e672b6064eb9cf6c235c6810f7bfa80"
"hash": "dd9a85ea740742d620e864796f67c5bff834486d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 215,
"line": 191,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "e3dd840d2474f9865a45822872bf9ecfb15961d7"
"hash": "e3e59960d0d50709a57b336f66b586710b774892"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 216,
"line": 192,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "a32a60382b145cc7a4a7ebe01ec435b8e3103320"
"hash": "fe11b0e54396511e7b3b08615a78d22fc27e2fad"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/AddressSelection.vue",
"line": 246,
"line": 222,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "082447e5c731012f3acc282943502775dfd24797"
"hash": "63c14c2150c33ec701bc4a0ff94efde69537d490"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 118,
"line": 96,
"column": 20,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "d4fba4fe09af3c0937c0dd164928c8930c1591b5"
"hash": "d2a9fdaeef0e2810f480022d4c6f99e4f76a818e"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 118,
"line": 96,
"column": 20,
"ruleId": "vue/no-side-effects-in-computed-properties",
"message": "Unexpected side effect in \"cities\" computed property.",
"hash": "1113a114d5aaf9f32f442916d25458541c5af35c"
"hash": "dd92a60a9b1ebefeb9a90941d45326fbfa483733"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 102,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "04be01ab638ce01f568fb0216929e65e1175ca23"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 110,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "8619c8e0b63e87d09268832f90e4fba06b87e41f"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 124,
"column": 17,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "fa56a7c93583f0a9d0c2ecac10228c4f4fc1bc3a"
"hash": "281f918da00635079501418b1e6b2c05b62eb4a7"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 132,
"column": 17,
"line": 125,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "9fe87937ea67d1dae95fb3d44d4be0da2eba0905"
"hash": "c131b09fa67ab1d069f1d04a54582d6b0f206153"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 126,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "3d3a2a4add64c291b8f5f1cddd90a173cd6a819d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 131,
"column": 21,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "ed48f4988914d7897018a2e06830a97e6740b3e8"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 145,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "744f3a7610d4d6015e50e25149bceffd6c6e2763"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
@@ -1241,139 +1441,115 @@
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 148,
"column": 13,
"line": 149,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "ab4f478fbfbc954b8dff75176dcd432f9ff28cfc"
"hash": "1e7b1ad55866f708baaca72dfa4ff26d6f8e5d21"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 153,
"column": 21,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "1d907d149f9ddb62e32140a90efe9a74b3e71fef"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 167,
"line": 152,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "8aa37d2d4f011773e68838a2c88017875de563b5"
"hash": "84779331536ffceec8d4a8c5ca4307310b882549"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 168,
"line": 161,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "a4827a357e52a51fa9262319114d81a130296acf"
"hash": "0789999841be671a4d8ab080d6fdb679f843eb52"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 169,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "a4c9715664202949e3242b8d4aa4098288b46dc4"
"line": 170,
"column": 51,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "bbb17afa114f016e2058d90aa32d2a625804f0d1"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 171,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "f3e9e21e433e90ec7b615b8940d43c4177372b66"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 174,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "770b7a24cc24b380e88db47d62422c8e1ece2571"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 183,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "2aef3c519a9ec6abcfe7573989d3de19d5c4c752"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 193,
"column": 33,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "5d1f97e4d7d9f47399d312e8b9f95ef9e3843b8c"
"hash": "5fbe407ceceb37bff2ac800ceddd7942540132f1"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 190,
"column": 55,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'reject' is defined but never used.",
"hash": "e2af91def877befbabef8e93deba4c58a3ee2ded"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 191,
"column": 37,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "ee8544ee45681a650ed7d4918ae979685cdd8f0f"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 210,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "5d9d2217c8c7e6571bc9f72a98ea5b370edb4968"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 211,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "6e04619b373c23c91f6c36c2aad314ac16cdb697"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 212,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "39df045639a62f64ccdb03a80e286bc3ad772587"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 213,
"column": 37,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "c1df874f790ef0c036bf58ae8a8db1ee173685d4"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 232,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "476e6588a28ac9382e8b9d2e63a8babecd23bad8"
"hash": "c399a43fa797a8ce61c9d96a644a39cc84a387b7"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 233,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "6a0c82ba72d6d87217bf33a6ad8e40a4b81bc802"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 234,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "741d5af6c7d90041c0dc1c1df2e8699b80fca69a"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 235,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "c3ffd141f58d532663875cc5c7d338ed00db2a6d"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CitySelection.vue",
"line": 267,
"line": 245,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "2700f258396516a2fe971618fafbcdf72cdda3ab"
"hash": "04337a07944caaa4819cfebcf29e1a7cbfdf248b"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue",
"line": 94,
"line": 76,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "4be1b0592efa775092a91a1d744e16ce98bd216e"
"hash": "373a2e31f110d138c66d77f1faf5dc61545c55af"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress/CountrySelection.vue",
"line": 99,
"line": 81,
"column": 13,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "19b54b6d76c30249d520a296f826eda9d6eb0668"
"hash": "421eb6a63224b4b1d81b216677a710c5c99ddee3"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/DatePane.vue",
@@ -1393,19 +1569,19 @@
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue",
"line": 169,
"line": 155,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "dcb7b34098062760ddbb849655a5bb3ca65c36d3"
"hash": "b3a822914fcb5e2fcf28efc331a45b9205002eeb"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/EditPane.vue",
"line": 178,
"line": 164,
"column": 17,
"ruleId": "vue/no-mutating-props",
"message": "Unexpected mutation of \"entity\" prop.",
"hash": "86b3ecf201025cac36878c5e4bf8850fb9d58cb5"
"hash": "72c7d850f6cdeaf65b373a33234222f9766ee30b"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js",
@@ -1455,6 +1631,14 @@
"message": "'app' is assigned a value but never used.",
"hash": "9e6125f4fc387dc362c69cc6e3ce360eb2851f1b"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue",
"line": 60,
"column": 22,
"ruleId": "vue/require-valid-default-prop",
"message": "Type of the default value for 'suggested' prop must be a function.",
"hash": "d30212820bc2e97fa02d75dbc3a014558693f169"
},
{
"path": "src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddressDetails/Parts/AddressDetailsMap.vue",
"line": 24,
@@ -1543,6 +1727,14 @@
"message": "'tags' is assigned a value but never used.",
"hash": "ae9bb2e0651c118ed9efd227e88b86cc83f5d80d"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StickyNav.vue",
"line": 116,
"column": 18,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'event' is defined but never used.",
"hash": "201f182769c6dfb87148b841e7d9b592be429669"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js",
"line": 19,
@@ -1575,6 +1767,14 @@
"message": "'app' is assigned a value but never used.",
"hash": "aaaaa63e7a60443b8cbf8191feb9142852ebdf1c"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue",
"line": 79,
"column": 13,
"ruleId": "vue/require-v-for-key",
"message": "Elements in iteration expect to have 'v-bind:key' directives.",
"hash": "422f53925922e59655d0f71624c19af75d41628c"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js",
"line": 12,
@@ -1615,6 +1815,22 @@
"message": "'evalFQDN' is assigned a value but never used.",
"hash": "7fc32caafa23addddf44f3acbc5045b4523a0271"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js",
"line": 611,
"column": 9,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'errors' is assigned a value but never used.",
"hash": "c41cf979fc1626c38328dbf1028800c3395496bd"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/App.vue",
"line": 282,
"column": 7,
"ruleId": "@typescript-eslint/no-unused-expressions",
"message": "Expected an assignment or function call and instead saw an expression.",
"hash": "de3a6e2bb10a80a2bacba665be74266c7efc7d64"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js",
"line": 16,
@@ -1631,6 +1847,38 @@
"message": "'app' is assigned a value but never used.",
"hash": "2f161e663689e3e4dfe2c53b0d64c91a4d2b1a60"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue",
"line": 263,
"column": 19,
"ruleId": "vue/return-in-computed-property",
"message": "Expected to return a value in \"refreshNetwork\" computed property.",
"hash": "2c1b08a49098c83b09058cedc0a962126e91e544"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue",
"line": 270,
"column": 7,
"ruleId": "vue/no-side-effects-in-computed-properties",
"message": "Unexpected side effect in \"legendLayers\" computed property.",
"hash": "760948d2187c853f17ac9a1bd7107e883092d4f4"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue",
"line": 281,
"column": 5,
"ruleId": "vue/no-dupe-keys",
"message": "Duplicate key 'checkedLayers'. May cause name collision in script or template tag.",
"hash": "447edb461e15e3ff5c60c8ecba88131e442539aa"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/App.vue",
"line": 353,
"column": 7,
"ruleId": "@typescript-eslint/no-unused-expressions",
"message": "Expected an assignment or function call and instead saw an expression.",
"hash": "9cf656cbf1eb3d7cc0082e63adcd320b6093d14f"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js",
"line": 20,
@@ -1639,6 +1887,22 @@
"message": "'app' is assigned a value but never used.",
"hash": "9e94e6412b8a44e47bfe8e66218cad09cff5bed4"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue",
"line": 42,
"column": 16,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'response' is defined but never used.",
"hash": "62de07b13c662e32332bb062038acee23978ea70"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue",
"line": 356,
"column": 28,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'_response' is defined but never used.",
"hash": "097e7788a2b5dea500b80b8a3cf968e57063a66a"
},
{
"path": "src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeUserGroup.vue",
"line": 6,
@@ -1654,5 +1918,45 @@
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'UserRenderBoxBadge' is defined but never used.",
"hash": "99eba0d8633b2c9497417f4f61ec4194dbb2a96b"
},
{
"path": "src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index.ts",
"line": 4,
"column": 3,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'StoredObjectStatus' is defined but never used.",
"hash": "63f8c4572293916850d6165647774b27d4b732c6"
},
{
"path": "src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index.ts",
"line": 5,
"column": 3,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'StoredObjectStatusChange' is defined but never used.",
"hash": "a87c178e3eb5999bf0f46b3fa1c6da77e1be08b9"
},
{
"path": "src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index.ts",
"line": 30,
"column": 61,
"ruleId": "@typescript-eslint/no-unused-vars",
"message": "'e' is defined but never used.",
"hash": "02953121583f4f73742a19adab099ab63df9076e"
},
{
"path": "src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index.ts",
"line": 31,
"column": 32,
"ruleId": "@typescript-eslint/no-explicit-any",
"message": "Unexpected any. Specify a different type.",
"hash": "af48e21a1651b6017ede882dab249c00a818a44d"
},
{
"path": "src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index.ts",
"line": 37,
"column": 16,
"ruleId": "@typescript-eslint/no-explicit-any",
"message": "Unexpected any. Specify a different type.",
"hash": "7513ea552a0a649ce4ab93b6cf9d40bfef4f68d9"
}
]

3
.gitignore vendored
View File

@@ -18,9 +18,6 @@ migrations/*
templates/*
translations/*
# we allow developers to add customization on their installation, without commiting it
config/packages/dev/*
###> symfony/framework-bundle ###
/.env.local
/.env.local.php

View File

@@ -27,11 +27,11 @@ Chill is a comprehensive web application built as a set of Symfony bundles. It i
## Project Structure
Note: This is a project that's existed for a long time, and throughout the years we've used multiple structures inside each bundle. When having the choice, the developers should choose the new structure.
Note: This is a project which exists from a long time ago, and we found multiple structure inside each bundle. When having the choice, the developers should choose the new structure.
The project follows a standard Symfony bundle structure:
- `/src/Bundle/`: Contains all the Chill bundles. The code is either at the root of the bundle directory, or within a `src/` directory (preferred). See psr4 mapping at the root's `composer.json`.
- each bundle comes with its own tests, either in the `Tests` directory (when the code is directly within the bundle directory (for instance `src/Bundle/ChillMainBundle/Tests`, `src/Bundle/ChillPersonBundle/Tests`)), or inside the `tests` directory, alongside the `src/` sub-directory (example: `src/Bundle/ChillWopiBundle/tests`) (this is the preferred way).
- each bundle come with his own tests, either in the `Tests` directory (when the code is directly within the bundle directory (for instance `src/Bundle/ChillMainBundle/Tests`, `src/Bundle/ChillPersonBundle/Tests`)), or inside the `tests` directory, alongside to the `src/` sub-directory (example: `src/Bundle/ChillWopiBundle/tests`) (this is the preferred way).
- `/docs/`: Contains project documentation
Each bundle typically has the following structure:
@@ -46,13 +46,13 @@ Each bundle typically has the following structure:
### A special word about TicketBundle
The ticket bundle is developed using a kind of "Command" pattern. The controller fills a "Command," and a "CommandHandler" handles this command. They are saved in the `src/Bundle/ChillTicketBundle/src/Action` directory.
The ticket bundle is developed using a kind of "Command" pattern. The controller fill a "Command", and a "CommandHandler" handle this command. They are savec in the `src/Bundle/ChillTicketBundle/src/Action` directory.
## Development Guidelines
### Building and Configuration Instructions
All the commands should be run through the `symfony` command, which will configure the required variables.
All the command should be run through the `symfony` command, which will configure the required variables.
For assets, we must ensure that we use node at version `^20.0.0`. This is done using `nvm use 20`.
@@ -87,7 +87,7 @@ For assets, we must ensure that we use node at version `^20.0.0`. This is done u
docker compose up -d
```
6. **Set Up the Database**:
5. **Set Up the Database**:
```bash
# Create the database
symfony console doctrine:database:create
@@ -99,20 +99,20 @@ For assets, we must ensure that we use node at version `^20.0.0`. This is done u
symfony console doctrine:fixtures:load
```
7. **Build Assets**:
6. **Build Assets**:
```bash
nvm use 20
yarn run encore dev
```
8. **Start the Development Server**:
7. **Start the Development Server**:
```bash
symfony server:start -d
```
#### Docker Setup
The project includes a Docker configuration for easier development:
The project includes Docker configuration for easier development:
1. **Start Docker Services**:
```bash
@@ -153,9 +153,9 @@ Key configuration files:
Each time a doctrine entity is created, we generate migration to adapt the database.
The migration is created using the command `symfony console doctrine:migrations:diff --no-interaction --namespace <namespace>`, where the namespace is the relevant namespace for migration. As this is a bash script, remember to quote the `\` (`\` must become `\\` in your command).
The migration are created using the command `symfony console doctrine:migrations:diff --no-interaction --namespace <namespace>`, where the namespace is the relevant namespace for migration. As this is a bash script, do not forget to quote the `\` (`\` must become `\\` in your command).
Each bundle has his own namespace for migration (always ask me to confirm that command with a list of updated / created entities so that I can confirm to you that it is ok):
Each bundle has his own namespace for migration (always ask me to confirm that command, with a list of updated / created entities so that I can confirm you that it is ok):
- `Chill\Bundle\ActivityBundle` writes migrations to `Chill\Migrations\Activity`;
- `Chill\Bundle\BudgetBundle` writes migrations to `Chill\Migrations\Budget`;
@@ -183,7 +183,7 @@ Once created the, comment's classes should be removed and a description of the c
When we need to use a DateTime or DateTimeImmutable that need to express "now", we prefer the usage of
`Symfony\Component\Clock\ClockInterface`, where possible. This is usually not possible in doctrine entities,
where injection does not work when restoring an entity from a database, but usually possible in services.
where injection does not work when restoring an entity from database, but usually possible in services.
In test, we use `\Symfony\Component\Clock\MockClock` which is an implementation of `Symfony\Component\Clock\ClockInterface`
where we have full and easy control of the date.
@@ -198,9 +198,9 @@ The project uses PHPUnit for testing. Each bundle has its own test suite, and th
For creating mock, we prefer using prophecy (library phpspec/prophecy).
##### Useful helpers and tips that avoid creating a mock
##### Useful helpers and tips that avoid create a mock
Some notable implementations that are test helpers and avoid creating a mock:
Some notable implementations that are tests helper, and avoid to create a mock:
- `\Psr\Log\NullLogger`, an implementation of `\Psr\Log\LoggerInterface`;
- `\Symfony\Component\Clock\MockClock`, an implementation of `Symfony\Component\Clock\ClockInterface` (already mentioned above);
@@ -240,6 +240,9 @@ The tests are run from the project's root (not from the bundle's root).
# Run all tests
vendor/bin/phpunit
# Run tests for a specific bundle
vendor/bin/phpunit --testsuite NameBundle
# Run a specific test file
vendor/bin/phpunit path/to/TestFile.php
@@ -247,9 +250,6 @@ vendor/bin/phpunit path/to/TestFile.php
vendor/bin/phpunit --filter methodName path/to/TestFile.php
```
When writing tests, only test specific files. Do not run all tests or the full
test suite.
#### Test Structure
Tests are organized by bundle and follow the same structure as the bundle itself:
@@ -297,7 +297,7 @@ class TicketTest extends TestCase
#### Test Database
For tests that require a database, the project uses a postgresql database filled with fixtures (usage of doctrine-fixtures). You can configure a different database for testing in the `.env.test` file.
For tests that require a database, the project uses postgresql database filled by fixtures (usage of doctrine-fixtures). You can configure a different database for testing in the `.env.test` file.
### Code Quality Tools

View File

@@ -6,125 +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
## v4.6.0 - 2025-10-15
### Feature
* ([#423](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/423)) Create environment banner that can be activated and configured depending on the image deployed
* ([#394](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/394)) Only show active workflow on the page "my tracked workflow"
### Fixed
* Fix loading of classLists in SocialIssuesAcc.vue, ensure elements are present
* Fix the rendering of list of StoredObjectVersions, where there are kept version (before converting to pdf) and intermediate versions deleted
* ([#434](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/434)) Notification: fix editing of sent notification by removing form.addressesEmails, a field that no longer exists
* Fix loading of social issues and social actions within vue component
* ([#446](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/446)) Add unique condition on stored object filename, with cleaning step on existing duplicate filenames
**Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed
* [workflow] take permissions into account to delete the workflow attachment
* ([#448](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/448)) Fix the execution of daily cronjob notification, when the previous last execution storage was invalid
## 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
## 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
### 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
### DX
* 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
## v4.4.1 - 2025-09-11
### Fixed
* 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
### Fixed
* 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
**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
## v4.2.1 - 2025-09-03
### Fixed
* 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
* ([#64](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/64)) Add external identifier for a Person
**Schema Change**: Add columns or tables
* ([#330](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/330) Allow users to choose for which notifications they want to receive an email
### Fixed
* ([#422](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/422)) Fixed html layout of pages for recovering password
* Fix typo in 'uncheckAll' script for centers selection
* Fix incorrect parameter name in event details link
## 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
**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
### UX
* Limit display of participations in event list
## v4.0.2 - 2025-07-09
### Fixed
* Fix add missing translation

View File

@@ -14,7 +14,7 @@
"ext-openssl": "*",
"ext-redis": "*",
"ext-zlib": "*",
"champs-libres/wopi-bundle": "dev-symfony-v5@dev",
"champs-libres/wopi-bundle": "dev-master@dev",
"champs-libres/wopi-lib": "dev-master@dev",
"doctrine/data-fixtures": "^1.8",
"doctrine/doctrine-bundle": "^2.1",

View File

@@ -2,6 +2,7 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true],
ChampsLibres\WopiBundle\WopiBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
@@ -36,5 +37,4 @@ return [
Chill\WopiBundle\ChillWopiBundle::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],
];

View File

@@ -1,13 +1,6 @@
chill_main:
available_languages: [ '%env(resolve:LOCALE)%', 'en', 'nl' ]
available_languages: [ '%env(resolve:LOCALE)%', 'en' ]
available_countries: ['BE', 'FR']
top_banner:
visible: false
text:
fr: 'Vous travaillez actuellement avec la version de PRÉ-PRODUCTION.'
nl: 'Je werkt momenteel in de PRE-PRODUCTIE versie'
color: '#353535'
background_color: '#d8bb48'
notifications:
from_email: '%env(resolve:NOTIFICATION_FROM_EMAIL)%'
from_name: '%env(resolve:NOTIFICATION_FROM_NAME)%'

View File

@@ -1,2 +0,0 @@
chill_aside_activity:
show_concerned_persons_count: hidden

View File

@@ -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"

View File

@@ -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
===========

View File

@@ -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 &copy; 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

View File

@@ -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

View File

@@ -23,8 +23,8 @@ class "Document" {
- text description
- ArrayCollection_DocumentCategory categories
- varchar_150 content #link to openstack
- Territoire territoire
- Service service
- Center center
- Cercle cercle
- User user
- DateTime date # Creation date
}

View File

@@ -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) }}
```

View File

@@ -40,7 +40,7 @@ Example of configuration:
- { 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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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) }}
```

View File

@@ -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.

View File

@@ -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).

View File

@@ -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.

View File

@@ -35,19 +35,19 @@ 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.
#. 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
************
@@ -55,7 +55,7 @@ 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
- :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 :
@@ -174,7 +174,7 @@ 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.
simply remove the :code:`form_login` entry and all his options.
.. _command-and-crontab:

View File

@@ -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) }}
```

View File

@@ -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.

View File

@@ -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
```

View File

@@ -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 :
- `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
*******
@@ -185,7 +185,7 @@ Commands
********
`chill:person:move`
:code:`chill:person:move`
=========================
.. code-block:: txt
@@ -220,13 +220,13 @@ Move all the entities associated to a person onto another one, and remove the ol
- 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

View File

@@ -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.

View File

@@ -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
```

View 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

View File

@@ -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:

View File

@@ -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;
@@ -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;
@@ -213,11 +242,11 @@ You can customize the controller by hooking into the default actions. Take care
$qb->setParameter('now', new \DateTime('now'));
}
}
```
And set your controller in configuration:
```yaml
.. code-block:: yaml
chill_main:
apis:
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;
@@ -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
@@ -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;
@@ -610,14 +652,15 @@ You must, then, create your own CustomNormalizer. You can help yourself using th
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
```

View File

@@ -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') }}">
@@ -64,3 +94,11 @@ Any entry defined in the webpack.config.js file can be linked to your applicatio
...
<script src="{{ asset('build/app.js') }}"></script>
</body>
.. _Webpack Encore: https://www.npmjs.com/package/@symfony/webpack-encore
.. _Webpack: https://webpack.js.org/

View File

@@ -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

View 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

View File

@@ -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".
###### Create a new bundle
.. _create-new-bundle:
Create a new bundle
*******************
Create your own bundle is not a trivial task.
@@ -15,9 +19,16 @@ The easiest way to achieve this is seems to be :
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)
5. Move to a development installation, made as described in the :ref:`installation-for-development` section, and add your new repository to the composer.json file
6. Work as :ref:`usual <editing-code-and-commiting>`
.. warning::
This part of the doc is not yet tested
TODO
.. rubric:: Footnotes
.. [#f1] Be aware that we use the Affero GPL Licence, which ensure that all users must have access to derivative works done with this software.

View File

@@ -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.

View File

@@ -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;
@@ -75,14 +88,15 @@ Create your model on the usual way (in this example, ORM informations are stored
*/
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,13 +145,14 @@ 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:
-
@@ -169,11 +185,11 @@ The crud is configured using the key ``crud`` under ``chill_main``
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;
@@ -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,11 +376,12 @@ 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:
@@ -376,18 +399,19 @@ The entity will be passed to the role:
* 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 ?
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.
@@ -400,7 +424,8 @@ Inside this action, you can eventually call another internal method:
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.

View File

@@ -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`.

View 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 centres 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`.

View File

@@ -1,6 +1,6 @@
order,table_schema,table_name,commentaire
1,chill_3party,party_category,Catégorie de tiers
2,chill_3party,party_center,Association entre les tiers et les territoires (déprécié)
2,chill_3party,party_center,Association entre les tiers et les centres (déprécié)
3,chill_3party,party_profession,Profession du tiers (déprécié)
4,chill_3party,third_party,Tiers
5,chill_3party,thirdparty_category,association tiers - catégories
@@ -54,7 +54,7 @@ order,table_schema,table_name,commentaire
53,public,activitytpresence,Présence aux échanges
54,public,activitytype,Types d'échanges
55,public,activitytypecategory,Catégories de types d'échanges
56,public,centers,"Territoires (territoires, agences, etc.)"
56,public,centers,"Centres (territoires, agences, etc.)"
57,public,chill_activity_activity_chill_person_socialaction,
58,public,chill_activity_activity_chill_person_socialissue
59,public,chill_docgen_template,Gabarits de documents
@@ -111,7 +111,7 @@ order,table_schema,table_name,commentaire
110,public,chill_person_marital_status,Etats civils
111,public,chill_person_not_duplicate,
112,public,chill_person_person,Usagers
113,public,chill_person_person_center_history,Historique des territoires d'un usagers
113,public,chill_person_person_center_history,Historique des centres d'un usagers
114,public,chill_person_persons_to_addresses,Déprécié
115,public,chill_person_phone,Numéros d etéléphone supplémentaires d'un usager
116,public,chill_person_relations,Types de relations de filiation
@@ -142,7 +142,7 @@ order,table_schema,table_name,commentaire
141,public,permission_groups
142,public,permissionsgroup_rolescope
143,public,persons_spoken_languages
144,public,regroupment,Regroupement de territoires
144,public,regroupment,Regroupement de centres
145,public,regroupment_center,
146,public,role_scopes,
147,public,scopes,Services
1 order table_schema table_name commentaire
2 1 chill_3party party_category Catégorie de tiers
3 2 chill_3party party_center Association entre les tiers et les territoires (déprécié) Association entre les tiers et les centres (déprécié)
4 3 chill_3party party_profession Profession du tiers (déprécié)
5 4 chill_3party third_party Tiers
6 5 chill_3party thirdparty_category association tiers - catégories
54 53 public activitytpresence Présence aux échanges
55 54 public activitytype Types d'échanges
56 55 public activitytypecategory Catégories de types d'échanges
57 56 public centers Territoires (territoires, agences, etc.) Centres (territoires, agences, etc.)
58 57 public chill_activity_activity_chill_person_socialaction
59 58 public chill_activity_activity_chill_person_socialissue
60 59 public chill_docgen_template Gabarits de documents
111 110 public chill_person_marital_status Etats civils
112 111 public chill_person_not_duplicate
113 112 public chill_person_person Usagers
114 113 public chill_person_person_center_history Historique des territoires d'un usagers Historique des centres d'un usagers
115 114 public chill_person_persons_to_addresses Déprécié
116 115 public chill_person_phone Numéros d etéléphone supplémentaires d'un usager
117 116 public chill_person_relations Types de relations de filiation
142 141 public permission_groups
143 142 public permissionsgroup_rolescope
144 143 public persons_spoken_languages
145 144 public regroupment Regroupement de territoires Regroupement de centres
146 145 public regroupment_center
147 146 public role_scopes
148 147 public scopes Services

View File

@@ -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 }}`

View File

@@ -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``.

View File

@@ -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. */

View 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

View File

@@ -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 |
+-----------------------+----------------+---------------------------+
| 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

View File

@@ -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

View 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

View File

@@ -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!

View 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 !

View File

@@ -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.

View 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.

View File

@@ -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``.
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 :
`$logger = $this->get('chill.main.logger');`
.. code-block:: php
$logger = $this->get('chill.main.logger');
You should store data into context, not in the log himself, which should remains the same for the action.
Example of usage :
```php
.. code-block:: 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.

View File

@@ -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)

View File

@@ -1,94 +1,124 @@
###### 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'
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 :
* `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
.. warning::
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 :
* `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
* `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
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.
.. 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 :
`{{ 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 :
@@ -98,6 +128,16 @@ Arguments available in your template :
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>`

View File

@@ -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,37 +46,43 @@ 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 :
# 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 }
@@ -69,19 +94,30 @@ You may add the same route to multiple menus :
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`)

View File

@@ -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.

View 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.

View File

@@ -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>

View 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>

View File

@@ -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).

View 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>`_.

View File

@@ -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>
{{ 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`.

View File

@@ -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
#######
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;
@@ -48,4 +64,5 @@ But this forces users to modify config files. To avoid this, you may prepend con
));
}
}
```

View File

@@ -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
```

View 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

View File

@@ -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

View 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

View File

@@ -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>&nbsp;{{ '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 :
}
}
```

View File

@@ -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
{
// ...
@@ -33,13 +42,16 @@ 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');
@@ -49,10 +61,13 @@ Add the route for the current bundle automatically on the main app.
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

View File

@@ -1,63 +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".
# CSS classes and mixins
The stylesheet are based on the framework [ScratchCSS ](https://github.com/Champs-Libres/ScratchCSS).
We added some useful classes and mixins for the Chill usage.
###### CSS Classes
## Statement "empty data"
CSS Selector
`.chill-no-data-statement`
In which case will you use this selector ?
When a list is empty, and a message fill the list to inform that the data is empty
Example usage
```jinja
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
```
## Quotation of user text
CSS Selector
`blockquote.chill-user-quote`
In which case will you use this selector ?
When you quote text that were filled by the user in a form.
Example usage
```jinja
<blockquote class="chill-user-quote">{{ entity.remark|nl2br }}</blockquote>
```
## Boxes
CSS Selector
`chill__box`
In which case will you use this selector ?
When displaying some data in a nice box
Example usage
```html
<span class="chill__box green">A nice box with green background</span>
<span class="chill__box red">A nice box with red background</span>
```
###### Mixins
## Entity decorator
Mixin
`@mixin entity($background-color, $color: white)`
In which case including this mixin ?
When you create a `sticker`, a sort of label to represent a text in a way that the user can associate immediatly with a certain type of class / entity.
Example usage
```sass
span.entity.entity-activity.activity-reason {
@include entity($chill-pink, white);
}
```

View File

@@ -22,7 +22,7 @@ Statement "empty data"
======================
CSS Selector
`.chill-no-data-statement`
:code:`.chill-no-data-statement`
In which case will you use this selector ?
When a list is empty, and a message fill the list to inform that the data is empty
Example usage
@@ -35,7 +35,7 @@ Quotation of user text
=======================
CSS Selector
`blockquote.chill-user-quote`
:code:`blockquote.chill-user-quote`
In which case will you use this selector ?
When you quote text that were filled by the user in a form.
Example usage
@@ -47,7 +47,7 @@ Boxes
=====
CSS Selector
`chill__box`
:code:`chill__box`
In which case will you use this selector ?
When displaying some data in a nice box
Example usage
@@ -66,7 +66,7 @@ Entity decorator
=================
Mixin
`@mixin entity($background-color, $color: white)`
:code:`@mixin entity($background-color, $color: white)`
In which case including this mixin ?
When you create a `sticker`, a sort of label to represent a text in a way that the user can associate immediatly with a certain type of class / entity.
Example usage

View File

@@ -1,234 +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".
# Javascript functions
Some function may be useful to manipulate elements on the page.
###### Show-hide elements according to a form state
The module ``ShowHide`` will allow you to show/hide part of your page using a specific test.
This must be use inside a javascript module.
## Usage
In this module, the module will listen to all input given in the ``container_from`` div, and will show or hide the content of the ``container_target`` according to the result of the ``test`` function.
<div id="container_from">
{{ form_row(form.accompagnementRQTHDate) }}
</div>
<div id="container_target">
{{ form_row(form.accompagnementComment) }}
</div>
import { ShowHide } from 'ShowHide/show_hide.js';
var
from = document.getElementById("container_from"),
target = document.getElementById("container_target")
;
new ShowHide({
froms: [from], // the value of from should be an iterable
container: [target], // the value of container should be an iterable
test: function(froms, event) {
// iterate over each element of froms
for (let f of froms.values()) {
// get all input inside froms
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'autre') {
return input.checked;
}
}
}
return false;
}
});
Once instantiated, the class ``ShowHide`` will:
1. get all input from each element inside the ``froms`` values
2. attach an event listener (by default, ``change``) to each input inside each entry in ``froms``
3. each time the event is fired, launch the function ``test``
4. show the element in the container given in ``container``, if the result of ``test`` is true, or hide them otherwise.
The test is also launched when the page is loaded.
## Show/hide while the user enter data: using the ``input`` event
One can force to use another event on the input elements, instead of the default ``'change'`` event.
For achieving this, use the `event_name` option.
new ShowHide({
froms: froms,
test: test_function,
container: containers ,
// using this option, we use the event `input` instead of `change`
event_name: 'input'
});
### Examples
:language: javascript
## Using Show/Hide in collections forms
Using show / hide in collection forms implies:
* to launch show/hide manually for each entry when the page is loaded ;
* to catch when an entry is added to the form ;
As the show/hide is started manually and not on page load, we add the option ``load_event: null`` to the options:
new ShowHide({
load_event: null,
froms: [ from ],
container: [ container ],
test: my_test_function
});
When using ``load_event: null`` inside the options, the value of event will be ``null`` as second argument for the test function.
```javascript
my_test_function(froms, event) {
// event will be null on first launch
}
```
Example usage: here, we would like to catch for element inside a CV form, where the user may add multiple formation entries.
import { ShowHide } from 'ShowHide/show_hide.js';
// we factorize the creation of show hide element in this function.
var make_show_hide = function(entry) {
let
obtained = entry.querySelector('[data-diploma-obtained]'),
reconnue = entry.querySelector('[data-diploma-reconnue]')
;
new ShowHide({
load_event: null,
froms: [ obtained ],
container: [ reconnue ],
test: my_test_function
});
};
// this code is fired when an entry is added on the page
window.addEventListener('collection-add-entry', function(e) {
// if the form contains multiple collection, we filter them here:
if (e.detail.collection.dataset.collectionName === 'formations') {
make_show_hide(e.detail.entry);
}
});
// on page load, we create a show/hide
window.addEventListener('load', function(_e) {
let
formations = document.querySelectorAll('[data-formation-entry]')
;
for (let f of formations.values()) {
make_show_hide(f);
}
});
## Handling encapsulated show/hide elements
This module allow to handle encapsulated show/hide elements. For instance :
* in a first checkbox list, a second checkbox list is shown if some element is checked ;
* in this second checkbox list, a third input is shown if some element is checked inside the second checkbox list.
As a consequence, if the given element in the first checkbox list is unchecked, the third input must also be hidden.
Example: when a situation professionnelle is ``en activite``, the second element ``type contrat`` must be shown if ``en_activite`` is checked. Inside ``type_contrat``, ``type_contrat_aide`` should be shown when ``contrat_aide`` is checked.
<div id="situation_prof">
<input type="radio" name="situationProfessionnelle" value="" checked="checked" />
<input type="radio" name="situationProfessionnelle" value="sans_emploi" />
<input type="radio" name="situationProfessionnelle" value="en_activite" />
</div>
<div id="type_contrat">
<input type="checkbox" name="typeContrat[]" value="cdd" />
<input type="checkbox" name="typeContrat[]" value="cdi" />
<input type="checkbox" name="typeContrat[]" value="contrat_aide" />
</div>
<div id="type_contrat_aide">
<input type="text" name="typeContratAide" />
</div>
The JS code will be:
import { ShowHide } from 'ShowHide/show_hide.js';
// we search for the element within the DOM
// NOTE: all the elements should be searched before instanciating the showHides.
// if not, the elements **may** have disappeared from the DOM
var
situation_prof = document.getElementById('situation_prof'),
type_contrat = document.getElementById('type_contrat'),
type_contrat_aide = document.getElementById('type_contrat_aide'),
;
// the first show/hide will apply on situation_prof
new ShowHide({
// the id will help us to keep a track of the element
id: 'situation_prof_type_contrat',
froms: [situation_prof],
container: [type_contrat],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'en_activite') {
return input.checked;
}
}
}
return false;
}
});
// the show/hide will apply on "contrat aide"
var show_hide_contrat_aide = new ShowHide({
froms: [type_contrat],
container: [type_contrat_aide],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value === 'contrat_aide') {
return input.checked;
}
}
}
return false;
}
});
// we handle here the case when the first show-hide is changed: the third input must also disappears
window.addEventListener('show-hide-hide', function (e) {
if (e.detail.id = 'situation_prof_type_contrat') {
// we force the 3rd element to disappears
show_hide_contrat_aide.forceHide();
}
});
// when the first show-hide is changed, it makes appears the second one.
// we check here that the second show-hide is processed.
window.addEventListener('show-hide-show', function (e) {
if (e.detail.id = 'situation_prof_type_contrat') {
show_hide_contrat_aide.forceCompute();
}
});

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