mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'features/activity-model' into features/activity-form
This commit is contained in:
commit
45671bda52
64
.env
Normal file
64
.env
Normal file
@ -0,0 +1,64 @@
|
||||
##
|
||||
## Manually dump .env files in .env.local.php with
|
||||
## `$ composer symfony:dump-env prod`
|
||||
##
|
||||
|
||||
## Project environment
|
||||
APP_ENV=dev
|
||||
|
||||
## Enable debug
|
||||
APP_DEBUG=true
|
||||
|
||||
## Locale
|
||||
LOCALE=fr
|
||||
|
||||
## Framework secret
|
||||
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
||||
|
||||
## Symfony/swiftmailer
|
||||
MAILER_TRANSPORT=smtp
|
||||
MAILER_HOST=smtp
|
||||
MAILER_PORT=1025
|
||||
MAILER_CRYPT=
|
||||
MAILER_AUTH=
|
||||
MAILER_USER=
|
||||
MAILER_PASSWORD=
|
||||
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
||||
|
||||
## Notifications
|
||||
NOTIFICATION_HOST=localhost:8001
|
||||
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
||||
NOTIFICATION_FROM_NAME=Chill
|
||||
|
||||
## Gelf
|
||||
GELF_HOST=gelf
|
||||
GELF_PORT=12201
|
||||
|
||||
## OVH OpenStack Storage User/Role
|
||||
OS_USERNAME=
|
||||
OS_PASSWORD=
|
||||
OS_TENANT_ID=
|
||||
OS_REGION_NAME=GRA
|
||||
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
||||
|
||||
## OVH OpenStack Storage Container
|
||||
ASYNC_UPLOAD_TEMP_URL_KEY=
|
||||
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
||||
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
||||
|
||||
## Redis Cache
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
||||
|
||||
## Twilio
|
||||
TWILIO_SID=~
|
||||
TWILIO_SECRET=~
|
||||
|
||||
## DOCKER IMAGES REGISTRY
|
||||
#IMAGE_PHP=
|
||||
#IMAGE_NGINX=
|
||||
|
||||
## DOCKER IMAGES VERSION
|
||||
#VERSION=test
|
||||
VERSION=prod
|
6
.env.test
Normal file
6
.env.test
Normal file
@ -0,0 +1,6 @@
|
||||
# variables for .env environement
|
||||
# those variables suits for gitlab-ci
|
||||
# Run tests from root to adapt your own environment
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8
|
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,3 +1,20 @@
|
||||
.composer/*
|
||||
composer.phar
|
||||
composer.lock
|
||||
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
/.env.local
|
||||
/.env.local.php
|
||||
/.env.*.local
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
/public/bundles/
|
||||
/var/
|
||||
/vendor/
|
||||
/bin/
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
###> phpunit/phpunit ###
|
||||
/phpunit.xml
|
||||
.phpunit.result.cache
|
||||
###< phpunit/phpunit ###
|
||||
|
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||
|
||||
# Select what we should cache between builds
|
||||
cache:
|
||||
paths:
|
||||
- tests/app/vendor/
|
||||
|
||||
before_script:
|
||||
# add extensions to postgres
|
||||
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
# Install and run Composer
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php composer.phar install
|
||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||
- php tests/app/bin/console doctrine:fixtures:load -n
|
||||
|
||||
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
||||
services:
|
||||
- name: postgres:12
|
||||
alias: db
|
||||
- name: redis
|
||||
alias: redis
|
||||
|
||||
# Set any variables we need
|
||||
variables:
|
||||
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
# fetch the chill-app using git submodules
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
||||
# Run our tests
|
||||
test:
|
||||
script:
|
||||
- bin/phpunit --colors=never
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "_exts/sphinx-php"]
|
||||
path = _exts/sphinx-php
|
||||
url = https://github.com/fabpot/sphinx-php.git
|
||||
[submodule "tests/app"]
|
||||
path = tests/app
|
||||
url = https://gitlab.com/Chill-projet/chill-app.git
|
||||
|
@ -19,10 +19,14 @@
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\": "tests/app/src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"symfony/flex": "^1.9",
|
||||
"symfony/form": "4.*",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
@ -66,6 +70,17 @@
|
||||
"symfony/stopwatch": "^5.1",
|
||||
"symfony/web-profiler-bundle": "^5.0",
|
||||
"symfony/var-dumper": "4.*",
|
||||
"symfony/debug-bundle": "^5.1"
|
||||
"symfony/debug-bundle": "^5.1",
|
||||
"symfony/phpunit-bridge": "^5.2"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"vendor-dir": "tests/app/vendor",
|
||||
"bin-dir": "bin"
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Install Chill for development <installation.rst>
|
||||
Instructions to create a new bundle <create-a-new-bundle.rst>
|
||||
CRUD (Create - Update - Delete) for one entity <crud.rst>
|
||||
Routing <routing.rst>
|
||||
@ -30,7 +29,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
||||
Timelines <timelines.rst>
|
||||
Exports <exports.rst>
|
||||
Embeddable comments <embeddable-comments.rst>
|
||||
Testing <make-test-working.rst>
|
||||
Run tests <run-tests.rst>
|
||||
Useful snippets <useful-snippets.rst>
|
||||
manual/index.rst
|
||||
Assets <assets.rst>
|
||||
|
@ -1,155 +0,0 @@
|
||||
.. 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".
|
||||
|
||||
.. _installation-for-development :
|
||||
|
||||
Installation for development
|
||||
****************************
|
||||
|
||||
Installation for development should allow:
|
||||
|
||||
- access to the source code,
|
||||
- upload the code to our CVS (i.e. `git`_) and
|
||||
- work with `composer`_.
|
||||
|
||||
As Chill is divided into bundles (the Symfony name for 'modules'), each bundle has his own repository.
|
||||
|
||||
Installation and big picture
|
||||
----------------------------
|
||||
|
||||
First, you should install Chill as described in the :ref:`basic-installation` section.
|
||||
|
||||
Two things must be modified :
|
||||
|
||||
First, add the `--prefer-source` argument when you create project.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer create-project chill-project/standard path/to/your/directory --stability=dev --prefer-source
|
||||
|
||||
Second, when composer ask you the following question : ::
|
||||
|
||||
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]?
|
||||
|
||||
**You should answer `n` (no).**
|
||||
|
||||
Once Chill is installed, all the downloaded bundles will be stored in the `/vendor` directories.
|
||||
In those directories, you will have access to the git commands.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd vendor/chill-project/main/
|
||||
$ git remote -v
|
||||
composer git://github.com/Chill-project/Standard.git (fetch)
|
||||
composer git://github.com/Chill-project/Standard.git (push)
|
||||
origin git://github.com/Chill-project/Standard.git (fetch)
|
||||
origin git@github.com:Chill-project/Standard.git (push)
|
||||
|
||||
Files cleaning after installation
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Composer will delete unrequired files, and add some. This is perfectly normal and will appears in your git index.
|
||||
But you should NOT delete those files.
|
||||
|
||||
This is the expected 'git status' result:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$git status
|
||||
#(...)
|
||||
|
||||
Modifications qui ne seront pas validées :
|
||||
(utilisez "git add/rm <fichier>..." pour mettre à jour ce qui sera validé)
|
||||
(utilisez "git checkout -- <fichier>..." pour annuler les modifications dans la copie de travail)
|
||||
|
||||
modifié: app/SymfonyRequirements.php
|
||||
supprimé: app/SymfonyStandard/Composer.php
|
||||
supprimé: app/SymfonyStandard/RootPackageInstallSubscriber.php
|
||||
modifié: app/check.php
|
||||
|
||||
You can ignore the local changes using the `git update-index --assume-unchanged` command.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git update-index --assume-unchanged app/check.php
|
||||
$ git update-index --assume-unchanged app/SymfonyRequirements.php
|
||||
$ git update-index --assume-unchanged app/SymfonyStandard/Composer.php
|
||||
$ git update-index --assume-unchanged app/SymfonyStandard/RootPackageInstallSuscriber.php
|
||||
|
||||
Working with your own fork
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Ideally, you will work on a fork of the main github repository.
|
||||
To ensure that composer will download the code from **your** repository, you will have to adapt the `composer.json` file accordingly, using your own repositories.
|
||||
|
||||
For each Chill module that you have forked, add an indexed array into the "repositories" key of the composer.json file
|
||||
at the root of the chill installation directory if you want to force composer to download from your own forked repositories:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git://github.com/your-github-username/ChillMain.git"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"url": "git://github.com/your-github-username/Chill-Person.git"
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Then run composer update to load your forked code.
|
||||
If it does not happen, delete the content of the chill/vendor/chill-project/my_forked_bundle and relaunch composer update and the code will be downloaded from your fork.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer update
|
||||
|
||||
You may also `use aliases <https://getcomposer.org/doc/articles/aliases.md>`_ to define versions.
|
||||
|
||||
.. _editing-code-and-commiting :
|
||||
|
||||
Editing the code and commiting
|
||||
------------------------------
|
||||
|
||||
You may edit code in the `vendor/path/to/the/bundle` directory.
|
||||
|
||||
Once satisfied with your changes, you should commit as usually :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd vendor/path/to/bundle
|
||||
$ git status
|
||||
Sur la branche master
|
||||
Votre branche est à jour avec 'origin/master'.
|
||||
|
||||
rien à valider, la copie de travail est propre
|
||||
|
||||
.. warning
|
||||
|
||||
The git command must be run from you vendor bundle's path (`vendor/path/to/bundle`).
|
||||
|
||||
Tips
|
||||
^^^^
|
||||
|
||||
The command `composer status` (`see composer documentation <https://getcomposer.org/doc/03-cli.md#status>`_) will give you and idea of which bundle has been edited :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd ./../../ #back to the root project directory
|
||||
$ composer status
|
||||
You have changes in the following dependencies:
|
||||
/path/to/your/project/install/vendor/chill-project/main
|
||||
Use --verbose (-v) to see modified files
|
||||
|
||||
|
||||
|
||||
|
||||
.. _git: http://git-scm.org
|
||||
.. _composer: https://getcomposer.org
|
@ -1,231 +0,0 @@
|
||||
.. 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".
|
||||
|
||||
Make tests working
|
||||
******************
|
||||
|
||||
Unit and functional tests are important to ensure that bundle may be deployed securely.
|
||||
|
||||
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.
|
||||
|
||||
.. note::
|
||||
|
||||
Integration tools (i.e. `travis-ci <https://travis-ci.org>`_) works like this :
|
||||
|
||||
* they clone the bundle repository in a virtual machine, using git
|
||||
* they optionnaly run `composer` to download and install depedencies
|
||||
* they optionnaly run other command to prepare a database, insert fixtures, ...
|
||||
* they run test
|
||||
|
||||
On the developer's machine test should be runnable with two or three commands **runned from the bundle directory** :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ composer install --dev
|
||||
$ // command to insert fixtures, ...
|
||||
$ phpunit
|
||||
|
||||
This chapter has been inspired by `this useful blog post <http://blog.kevingomez.fr/2013/01/09/functional-testing-standalone-symfony2-bundles/>`_.
|
||||
|
||||
Bootstrap phpunit for a standalone bundle
|
||||
==========================================
|
||||
|
||||
Unit tests should run after achieving this step.
|
||||
|
||||
|
||||
phpunit.xml
|
||||
-----------
|
||||
|
||||
A `phpunit.xml.dist` file should be present at the bundle root.
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
||||
<!-- the file "./Tests/boostrap.php" will be created on the next step -->
|
||||
<testsuites>
|
||||
<testsuite name="ChillMain test suite">
|
||||
<directory suffix="Test.php">./Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./</directory>
|
||||
<exclude>
|
||||
<directory>./Resources</directory>
|
||||
<directory>./Tests</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
|
||||
|
||||
bootstrap.php
|
||||
--------------
|
||||
|
||||
A file `boostrap.php`, located in the `Tests` directory, will allow phpunit to resolve class autoloading :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) {
|
||||
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
|
||||
}
|
||||
|
||||
require $autoloadFile;
|
||||
|
||||
|
||||
composer.json
|
||||
-------------
|
||||
|
||||
The `composer.json` file **located at the bundle's root** should contains all depencies needed to run test (and to execute bundle functions).
|
||||
|
||||
Ensure that all dependencies are included in the `require` and `require-dev` sections.
|
||||
|
||||
|
||||
Functional tests
|
||||
================
|
||||
|
||||
If you want to access services, database, and run functional tests, you will have to bootstrap a symfony app, with the minimal configuration. Three files are required :
|
||||
|
||||
* a `config_test.yml` file (eventually with a `config.yml`);
|
||||
* a `routing.yml` file
|
||||
* an `AppKernel.php` file
|
||||
|
||||
Adapt phpunit.xml
|
||||
-----------------
|
||||
|
||||
You should add reference to the new application within `phpunit.xml.dist`. The directive `<php>` should be added like this, if your `AppKernel.php` file is located in `Tests/Fixtures/App` directory:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="ChillMain test suite">
|
||||
<directory suffix="Test.php">./Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./</directory>
|
||||
<exclude>
|
||||
<directory>./Resources</directory>
|
||||
<directory>./Tests</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<!-- the lines we added -->
|
||||
<php>
|
||||
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/" />
|
||||
</php>
|
||||
</phpunit>
|
||||
|
||||
AppKernel.php
|
||||
-------------
|
||||
|
||||
This file boostrap the app. It contains three functions. This is the file used in the ChillMain bundle :
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
class AppKernel extends Kernel
|
||||
{
|
||||
public function registerBundles()
|
||||
{
|
||||
return array(
|
||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||
new Chill\MainBundle\ChillMainBundle(),
|
||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||
#add here all the required bundle (some bundle are not required)
|
||||
);
|
||||
}
|
||||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheDir()
|
||||
{
|
||||
return sys_get_temp_dir().'/ChillMainBundle/cache';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogDir()
|
||||
{
|
||||
return sys_get_temp_dir().'/ChillMainBundle/logs';
|
||||
}
|
||||
}
|
||||
|
||||
config_test.yml
|
||||
---------------
|
||||
|
||||
There are only few parameters required for the config file. This is a basic version for ChillMain :
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/config_test.yml
|
||||
imports:
|
||||
- { resource: config.yml } #here we import a config.yml file, this is not required
|
||||
|
||||
framework:
|
||||
test: ~
|
||||
session:
|
||||
storage_id: session.storage.filesystem
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
# config/config.yml
|
||||
framework:
|
||||
secret: Not very secret
|
||||
router: { resource: "%kernel.root_dir%/config/routing.yml" }
|
||||
form: true
|
||||
csrf_protection: true
|
||||
session: ~
|
||||
default_locale: fr
|
||||
translator: { fallback: fr }
|
||||
profiler: { only_exceptions: false }
|
||||
templating: #required for assetic. Remove if not needed
|
||||
engines: ['twig']
|
||||
|
||||
.. note::
|
||||
|
||||
You must adapt config.yml file according to your required bundle. Some options will be missing, other may be removed...
|
||||
|
||||
.. note::
|
||||
|
||||
If you would like to tests different environments, with differents configuration, you could create differents config_XXX.yml files.
|
||||
|
||||
routing.yml
|
||||
------------
|
||||
|
||||
You should add there all routing information needed for your bundle.
|
||||
|
||||
.. code-block: yaml
|
||||
|
||||
chill_main_bundle:
|
||||
resource: "@CLChillMainBundle/Resources/config/routing.yml"
|
||||
|
||||
That's it. Tests should pass.
|
68
docs/source/development/run-tests.rst
Normal file
68
docs/source/development/run-tests.rst
Normal file
@ -0,0 +1,68 @@
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
Run tests
|
||||
*********
|
||||
|
||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||
|
||||
From chill app
|
||||
==============
|
||||
|
||||
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# run into a container
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# execute all tests suites
|
||||
bin/phpunit
|
||||
# .. or execute a single test
|
||||
bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php
|
||||
|
||||
You can also run tests in a single command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php bin/phpunit
|
||||
|
||||
|
||||
Tests from a bundle (chill-bundles)
|
||||
-----------------------------------
|
||||
|
||||
Those tests needs the whole symfony app to execute Application Tests (which test html page).
|
||||
|
||||
For ease, the app is cloned using a :code:`git submodule`, which clone the main app into :code:`tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||
|
||||
You may boostrap the tests fro the chill bundle this way:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# ensure to be located into the environement (provided by docker suits well)
|
||||
docker-compose exec --user $(id -u) php bash
|
||||
# go to chill subdirectory
|
||||
cd vendor/chill-project/chill-bundles
|
||||
# install submodule
|
||||
git submodule init
|
||||
git submodule update
|
||||
# install composer and dependencies
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
# run tests
|
||||
bin/phpunit
|
||||
|
||||
.. note::
|
||||
|
||||
If you are on a fresh install, you will need to migrate database schema.
|
||||
|
||||
The path to console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
tests/app/bin/console doctrine:migrations:migrate
|
||||
tests/app/bin/console doctrine:fixtures:load
|
||||
|
@ -30,21 +30,14 @@ Contents of this documentation:
|
||||
Let's talk together !
|
||||
======================
|
||||
|
||||
Subscribe to the dev mailing-list to discuss your project and extend Chill with the feature you need!
|
||||
|
||||
- `The dev mailing-list <https://lists.chill.social/listinfo/dev>`_
|
||||
- `Read the archives of the mailing-list <https://lists.chill.social/pipermail/dev/>`_
|
||||
|
||||
|
||||
You may talk to developers using the matrix room: `https://app.element.io/#/room/#chill-social-admin:matrix.org`_
|
||||
|
||||
Contribute
|
||||
==========
|
||||
|
||||
|
||||
* `Issue tracker <https://git.framasoft.org/groups/Chill-project/issues>`_ You may want to dispatch the issue in the multiple projects. If you do not know in which project is located your bug / feature request, use the project Chill-Main.
|
||||
* `The dev mailing-list <https://lists.chill.social/listinfo/dev>`_
|
||||
* `Issue tracker <https://gitlab.com/groups/Chill-project/issues>`_ You may want to dispatch the issue in the multiple projects. If you do not know in which project is located your bug / feature request, use the project Chill-Main.
|
||||
|
||||
Source code is dispatched in multiple bundle, to improve re-usability. Each bundle has dependencies with other chill bundle, but the developer take care that bundles may not be installed if the user do not need it.
|
||||
|
||||
User manual
|
||||
===========
|
||||
@ -56,22 +49,22 @@ An user manual exists in French and currently focuses on describing the main con
|
||||
Available bundles
|
||||
=================
|
||||
|
||||
* Chill-standard | https://git.framasoft.org/Chill-project/Chill-Standard This is the skeleton of the project. It does contains only few code, but information about configuration of your instance ;
|
||||
* Chill-Main : https://git.framasoft.org/Chill-project/Chill-Main : the main, required bundle for all the subsequent chill bundles. It contains the framework to add features (like searching, timeline, ...). It also provides the user managements (authentification and authorization) ;
|
||||
* Chill-Person : https://git.framasoft.org/Chill-project/Chill-Person This is the bundle which provides the possibility to create and add a person.
|
||||
* Chill-CustomFields : https://git.framasoft.org/Chill-project/Chill-CustomFields This bundle allows you to create custom fields on other bundles. It provides the framework for this features, and modify the schema according to this. It is required by Chill-Person and Chill-Report.
|
||||
* Chill-Report: https://git.framasoft.org/Chill-project/Chill-Report This bundle allow to add report about People recorded in your database ;
|
||||
* Chill-Activity : https://git.framasoft.org/Chill-project/Chill-Activity This bundle allow to add activities about People recorded in your database ;
|
||||
* Chill-ICPC2 : https://git.framasoft.org/Chill-project/Chill-ICPC2 This bundle provides a custom fields for `ICPC code <https://en.wikipedia.org/wiki/International_Classification_of_Primary_Care>`_ (international classification for primary care)
|
||||
* Chill-Group: https://git.framasoft.org/Chill-project/Chill-Group This bundle provides a way to create link between accompanyed people
|
||||
* Chill-Event: https://git.framasoft.org/Chill-project/Chill-Event This bundle provides a way to create event and associate people to event through a "participation"
|
||||
* Chill-Ldap: https://git.framasoft.org/Chill-project/Chill-Ldap Allow to synchronize the database with a ldap directory.
|
||||
* Chill-ONEStat : https://framagit.org/Chill-project/Chill-ONEStat Provide statistics for the Belgian one "Centre de vacances" and "Ecoles de devoir".
|
||||
* Chill-app | https://gitlab.com/Chill-project/Chill-app This is the skeleton of the project. It does contains only few code, but information about configuration of your instance ;
|
||||
* Chill-bundle: contains the main bundles, the most used in an instance. This means:
|
||||
* chill-main, the main framework,
|
||||
* Chill Person, to deal with persons,
|
||||
* chill custom fields, to add custom fields to some entities,
|
||||
* chill activity: to add activities to people,
|
||||
* chill report: to add report to people,
|
||||
* chill event: to gather people into events,
|
||||
* chill docs store: to store documents to people, but also entities,
|
||||
* chill task: to register task with people,
|
||||
* chill third party: to register third parties,
|
||||
* chill family members: to register family members
|
||||
|
||||
You will also found the following projects :
|
||||
|
||||
* The present documentation : https://git.framasoft.org/Chill-project/chill-documentation
|
||||
* The website https://chill.social : https://git.framasoft.org/Chill-project/chill.social
|
||||
* The website https://chill.social : https://gitlab.com/Chill-project/chill.social
|
||||
|
||||
And various project to build docker containers with Chill.
|
||||
|
||||
|
@ -27,13 +27,13 @@ Installation in development mode
|
||||
1. Get the code
|
||||
===============
|
||||
|
||||
Clone or download the chill-standard project and `cd` into the main directory.
|
||||
Clone or download the chill-app project and `cd` into the main directory.
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://framagit.org/Chill-project/Chill-Standard.git
|
||||
cd Chill-Standard
|
||||
git clone https://gitlab.com/Chill-Projet/chill-app.git
|
||||
cd chill-app
|
||||
|
||||
|
||||
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
|
||||
|
38
phpunit.xml.dist
Normal file
38
phpunit.xml.dist
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/app/tests/bootstrap.php"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="MainBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="PersonBundle">
|
||||
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
|
||||
</testsuite>
|
||||
|
||||
</testsuites>
|
||||
|
||||
<listeners>
|
||||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||
</listeners>
|
||||
|
||||
<!-- Run `composer require symfony/panther` before enabling this extension -->
|
||||
<!--
|
||||
<extensions>
|
||||
<extension class="Symfony\Component\Panther\ServerExtension" />
|
||||
</extensions>
|
||||
-->
|
||||
</phpunit>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class AdminActivityPresenceController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @param string $action
|
||||
* @param \Doctrine\ORM\QueryBuilder|mixed $query
|
||||
* @param Request $request
|
||||
* @param PaginatorInterface $paginator
|
||||
* @return \Doctrine\ORM\QueryBuilder|mixed
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||
{
|
||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||
return $query->orderBy('e.id', 'ASC');
|
||||
}
|
||||
}
|
@ -137,7 +137,28 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
'template' => '@ChillActivity/ActivityTypeCategory/edit.html.twig',
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'class' => \Chill\ActivityBundle\Entity\ActivityPresence::class,
|
||||
'name' => 'activity_presence',
|
||||
'base_path' => '/admin/activity/presence',
|
||||
'form_class' => \Chill\ActivityBundle\Form\ActivityPresenceType::class,
|
||||
'controller' => \Chill\ActivityBundle\Controller\AdminActivityPresenceController::class,
|
||||
'actions' => [
|
||||
'index' => [
|
||||
'template' => '@ChillActivity/ActivityPresence/index.html.twig',
|
||||
'role' => 'ROLE_ADMIN'
|
||||
],
|
||||
'new' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityPresence/new.html.twig',
|
||||
],
|
||||
'edit' => [
|
||||
'role' => 'ROLE_ADMIN',
|
||||
'template' => '@ChillActivity/ActivityPresence/edit.html.twig',
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
@ -20,13 +20,13 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\Document;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
@ -48,94 +48,118 @@ use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
|
||||
*/
|
||||
class Activity implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
const SENTRECEIVED_SENT = 'sent';
|
||||
const SENTRECEIVED_RECEIVED = 'received';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
*/
|
||||
private $user;
|
||||
private User $user;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $date;
|
||||
private \DateTime $date;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
* @ORM\Column(type="time")
|
||||
*/
|
||||
private $durationTime;
|
||||
private \DateTime $durationTime;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @ORM\Column(type="boolean")
|
||||
* @ORM\Column(type="time", nullable=true)
|
||||
*/
|
||||
private $attendee;
|
||||
private ?\DateTime $travelTime;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
|
||||
*/
|
||||
private ActivityPresence $attendee;
|
||||
|
||||
/**
|
||||
* @var ActivityReason
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
|
||||
*/
|
||||
private $reasons;
|
||||
private Collection $reasons;
|
||||
|
||||
/**
|
||||
* @var ActivityType
|
||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||
*/
|
||||
private $type;
|
||||
private ActivityType $type;
|
||||
|
||||
/**
|
||||
* @var Scope
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
|
||||
*/
|
||||
private $scope;
|
||||
private Scope $scope;
|
||||
|
||||
/**
|
||||
* @var Person
|
||||
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
private $person;
|
||||
private Person $person;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
*/
|
||||
private $comment;
|
||||
private CommentEmbeddable $comment;
|
||||
|
||||
/**
|
||||
* Activity constructor.
|
||||
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
|
||||
*/
|
||||
private Collection $persons;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
|
||||
*/
|
||||
private Collection $thirdParties;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\Document")
|
||||
*/
|
||||
private Collection $documents;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
|
||||
*/
|
||||
private Collection $users;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default"=false})
|
||||
*/
|
||||
private bool $emergency = false;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", options={"default"=""})
|
||||
*/
|
||||
private string $sentReceived = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
$this->comment = new CommentEmbeddable();
|
||||
$this->persons = new ArrayCollection();
|
||||
$this->thirdParties = new ArrayCollection();
|
||||
$this->documents = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user
|
||||
*
|
||||
* @param User $user
|
||||
* @return Activity
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
public function setUser(User $user): self
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
@ -144,21 +168,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUser()
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set date
|
||||
*
|
||||
* @param \DateTime $date
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDate($date)
|
||||
public function setDate(\DateTime $date): self
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
@ -167,21 +186,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get date
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDate()
|
||||
public function getDate(): \DateTime
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set durationTime
|
||||
*
|
||||
* @param \DateTime $durationTime
|
||||
* @return Activity
|
||||
*/
|
||||
public function setDurationTime($durationTime)
|
||||
public function setDurationTime(\DateTime $durationTime): self
|
||||
{
|
||||
$this->durationTime = $durationTime;
|
||||
|
||||
@ -190,75 +204,63 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get durationTime
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDurationTime()
|
||||
public function getDurationTime(): \DateTime
|
||||
{
|
||||
return $this->durationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set attendee
|
||||
*
|
||||
* @param boolean $attendee
|
||||
* @return Activity
|
||||
*/
|
||||
public function setAttendee($attendee)
|
||||
public function setTravelTime(\DateTime $travelTime): self
|
||||
{
|
||||
$this->travelTime = $travelTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTravelTime(): \DateTime
|
||||
{
|
||||
return $this->travelTime;
|
||||
}
|
||||
|
||||
public function setAttendee(ActivityPresence $attendee): self
|
||||
{
|
||||
$this->attendee = $attendee;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attendee
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAttendee()
|
||||
public function getAttendee(): ActivityPresence
|
||||
{
|
||||
return $this->attendee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a reason
|
||||
*
|
||||
* @param ActivityReason $reason
|
||||
* @return Activity
|
||||
*/
|
||||
public function addReason(ActivityReason $reason)
|
||||
public function addReason(ActivityReason $reason): self
|
||||
{
|
||||
$this->reasons[] = $reason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActivityReason $reason
|
||||
*/
|
||||
public function removeReason(ActivityReason $reason)
|
||||
public function removeReason(ActivityReason $reason): void
|
||||
{
|
||||
$this->reasons->removeElement($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reasons
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getReasons()
|
||||
public function getReasons(): Collection
|
||||
{
|
||||
return $this->reasons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param ActivityType $type
|
||||
* @return Activity
|
||||
*/
|
||||
public function setType(ActivityType $type)
|
||||
public function setType(ActivityType $type): self
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
@ -267,21 +269,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return ActivityType
|
||||
*/
|
||||
public function getType()
|
||||
public function getType(): ActivityType
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scope
|
||||
*
|
||||
* @param Scope $scope
|
||||
* @return Activity
|
||||
*/
|
||||
public function setScope(Scope $scope)
|
||||
public function setScope(Scope $scope): self
|
||||
{
|
||||
$this->scope = $scope;
|
||||
|
||||
@ -290,21 +287,16 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get scope
|
||||
*
|
||||
* @return Scope
|
||||
*/
|
||||
public function getScope()
|
||||
public function getScope(): Scope
|
||||
{
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set person
|
||||
*
|
||||
* @param Person $person
|
||||
* @return Activity
|
||||
*/
|
||||
public function setPerson(Person $person)
|
||||
public function setPerson(Person $person): self
|
||||
{
|
||||
$this->person = $person;
|
||||
|
||||
@ -313,10 +305,8 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
|
||||
/**
|
||||
* Get person
|
||||
*
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson()
|
||||
public function getPerson(): Person
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
@ -324,28 +314,150 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
/**
|
||||
* get the center
|
||||
* center is extracted from person
|
||||
*
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenter()
|
||||
public function getCenter(): Center
|
||||
{
|
||||
return $this->person->getCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
public function getComment()
|
||||
public function getComment(): CommentEmbeddable
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
||||
*/
|
||||
public function setComment($comment)
|
||||
public function setComment(CommentEmbeddable $comment): self
|
||||
{
|
||||
$this->comment = $comment;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a person to the person list
|
||||
*/
|
||||
public function addPerson(Person $person): self
|
||||
{
|
||||
$this->persons[] = $person;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePerson(Person $person): void
|
||||
{
|
||||
$this->persons->removeElement($person);
|
||||
}
|
||||
|
||||
public function getPersons(): Collection
|
||||
{
|
||||
return $this->persons;
|
||||
}
|
||||
|
||||
public function setPersons(Collection $persons): self
|
||||
{
|
||||
$this->persons = $persons;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addThirdParty(ThirdParty $thirdParty): self
|
||||
{
|
||||
$this->thirdParties[] = $thirdParty;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeThirdParty(ThirdParty $thirdParty): void
|
||||
{
|
||||
$this->thirdParties->removeElement($thirdParty);
|
||||
}
|
||||
|
||||
public function getThirdParties(): Collection
|
||||
{
|
||||
return $this->thirdParties;
|
||||
}
|
||||
|
||||
public function setThirdParties(Collection $thirdParties): self
|
||||
{
|
||||
$this->thirdParties = $thirdParties;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addDocument(Document $document): self
|
||||
{
|
||||
$this->documents[] = $document;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDocument(Document $document): void
|
||||
{
|
||||
$this->documents->removeElement($document);
|
||||
}
|
||||
|
||||
public function getDocuments(): Collection
|
||||
{
|
||||
return $this->documents;
|
||||
}
|
||||
|
||||
public function setDocuments(Collection $documents): self
|
||||
{
|
||||
$this->documents = $documents;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addUser(User $user): self
|
||||
{
|
||||
$this->users[] = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeUser(User $user): void
|
||||
{
|
||||
$this->users->removeElement($user);
|
||||
}
|
||||
|
||||
public function getUsers(): Collection
|
||||
{
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
public function setUsers(Collection $users): self
|
||||
{
|
||||
$this->users = $users;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isEmergency(): bool
|
||||
{
|
||||
return $this->getEmergency();
|
||||
}
|
||||
|
||||
public function getEmergency(): bool
|
||||
{
|
||||
return $this->emergency;
|
||||
}
|
||||
|
||||
public function setEmergency(bool $emergency): self
|
||||
{
|
||||
$this->emergency = $emergency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSentReceived(): string
|
||||
{
|
||||
return $this->sentReceived;
|
||||
}
|
||||
|
||||
public function setSentReceived(string $sentReceived): self
|
||||
{
|
||||
$this->sentReceived = $sentReceived;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
|
97
src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
Normal file
97
src/Bundle/ChillActivityBundle/Entity/ActivityPresence.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2015, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class ActivityPresence
|
||||
*
|
||||
* @package Chill\ActivityBundle\Entity
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="activitytpresence")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class ActivityPresence
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private ?int $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private bool $active = true;
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName(array $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): array
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* return true if the category type is active.
|
||||
*/
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is active
|
||||
* return true if the category type is active
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->getActive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
* set to true if the category type is active
|
||||
*/
|
||||
public function setActive(bool $active): self
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -37,8 +37,6 @@ class ActivityType
|
||||
const FIELD_REQUIRED = 2;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
@ -130,6 +128,16 @@ class ActivityType
|
||||
*/
|
||||
private string $durationTimeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
private int $travelTimeVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||
*/
|
||||
private string $travelTimeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
@ -180,6 +188,16 @@ class ActivityType
|
||||
*/
|
||||
private string $documentsLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
private int $usersVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default"=""})
|
||||
*/
|
||||
private string $usersLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||
*/
|
||||
@ -415,6 +433,26 @@ class ActivityType
|
||||
$this->durationTimeLabel = $durationTimeLabel;
|
||||
}
|
||||
|
||||
public function getTravelTimeVisible(): int
|
||||
{
|
||||
return $this->travelTimeVisible;
|
||||
}
|
||||
|
||||
public function setTravelTimeVisible(int $TravelTimeVisible): void
|
||||
{
|
||||
$this->travelTimeVisible = $TravelTimeVisible;
|
||||
}
|
||||
|
||||
public function getTravelTimeLabel(): string
|
||||
{
|
||||
return $this->travelTimeLabel;
|
||||
}
|
||||
|
||||
public function setTravelTimeLabel(string $TravelTimeLabel): void
|
||||
{
|
||||
$this->travelTimeLabel = $TravelTimeLabel;
|
||||
}
|
||||
|
||||
public function getAttendeeVisible(): int
|
||||
{
|
||||
return $this->attendeeVisible;
|
||||
@ -515,6 +553,26 @@ class ActivityType
|
||||
$this->documentsLabel = $documentsLabel;
|
||||
}
|
||||
|
||||
public function getUsersVisible(): int
|
||||
{
|
||||
return $this->usersVisible;
|
||||
}
|
||||
|
||||
public function setUsersVisible(int $usersVisible): void
|
||||
{
|
||||
$this->usersVisible = $usersVisible;
|
||||
}
|
||||
|
||||
public function getUsersLabel(): string
|
||||
{
|
||||
return $this->usersLabel;
|
||||
}
|
||||
|
||||
public function setUsersLabel(string $usersLabel): void
|
||||
{
|
||||
$this->usersLabel = $usersLabel;
|
||||
}
|
||||
|
||||
public function getEmergencyVisible(): int
|
||||
{
|
||||
return $this->emergencyVisible;
|
||||
|
@ -69,8 +69,6 @@ class ActivityTypeCategory
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return array | string
|
||||
*/
|
||||
public function getName(): array
|
||||
{
|
||||
|
33
src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
Normal file
33
src/Bundle/ChillActivityBundle/Form/ActivityPresenceType.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ActivityBundle\Form;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
|
||||
class ActivityPresenceType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class)
|
||||
->add('active', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'Yes' => true,
|
||||
'No' => false
|
||||
),
|
||||
'expanded' => true
|
||||
));
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => ActivityPresence::class
|
||||
));
|
||||
}
|
||||
}
|
@ -43,9 +43,9 @@ class ActivityTypeType extends AbstractType
|
||||
|
||||
$fields = [
|
||||
'persons', 'user', 'date', 'place', 'persons',
|
||||
'thirdParties', 'durationTime', 'attendee',
|
||||
'thirdParties', 'durationTime', 'travelTime', 'attendee',
|
||||
'reasons', 'comment', 'sentReceived', 'documents',
|
||||
'emergency', 'accompanyingPeriod', 'socialData'
|
||||
'emergency', 'accompanyingPeriod', 'socialData', 'users'
|
||||
];
|
||||
foreach ($fields as $field) {
|
||||
$builder
|
||||
|
@ -0,0 +1,12 @@
|
||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block layout_wvm_content %}
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{% block content_form_actions_view %}{% endblock %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
@ -0,0 +1,44 @@
|
||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>{{ 'ActivityPresence list'|trans }}</h1>
|
||||
|
||||
<table class="records_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<th>{{ 'Active'|trans }}</th>
|
||||
<th>{{ 'Actions'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||
<td style="text-align:center;">
|
||||
{%- if entity.active -%}
|
||||
<i class="fa fa-check-square-o"></i>
|
||||
{%- else -%}
|
||||
<i class="fa fa-square-o"></i>
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_crud_activity_presence_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_crud_activity_presence_new') }}" class="sc-button bt-create">
|
||||
{{ 'Create a new activity presence'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@ -0,0 +1,11 @@
|
||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block title %}
|
||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
||||
{% endblock %}
|
||||
|
||||
{% block layout_wvm_content %}
|
||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
@ -46,3 +46,12 @@ chill_activity_type_category_admin:
|
||||
admin_activity:
|
||||
order: 2999
|
||||
label: 'Activity Types Categories'
|
||||
|
||||
chill_activity_presence_admin:
|
||||
path: /{_locale}/admin/activity/presence
|
||||
controller: cscrud_activity_presence_controller:index
|
||||
options:
|
||||
menus:
|
||||
admin_activity:
|
||||
order: 2021
|
||||
label: 'Activity Presences'
|
||||
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20210422073711 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE activitytpresence_id_seq INCREMENT BY 1 MINVALUE 1 START 6');
|
||||
$this->addSql('CREATE TABLE activitytpresence (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
|
||||
|
||||
$list = [
|
||||
'Usager pésent', "Absence de l''usager",
|
||||
"Refus de visite ou d''entretien", 'Domicile non trouvé',
|
||||
'Domicile erronéee'
|
||||
];
|
||||
for ($i = 1; $i <= count($list); $i++) {
|
||||
$this->addSql("INSERT INTO activitytpresence VALUES(".$i.", json_build_object('fr', '".$list[$i-1]."'), true)");
|
||||
}
|
||||
|
||||
$this->addSql('ALTER TABLE activity ADD emergency BOOLEAN NOT NULL DEFAULT false');
|
||||
$this->addSql('ALTER TABLE activity ADD sentReceived VARCHAR(255) NOT NULL DEFAULT \'\' ');
|
||||
$this->addSql('ALTER TABLE activity ALTER attendee TYPE INT USING CASE WHEN attendee is false THEN 2 WHEN attendee is true THEN 1 ELSE null END');
|
||||
$this->addSql('ALTER TABLE activity RENAME COLUMN attendee TO attendee_id');
|
||||
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095ABCFD782A FOREIGN KEY (attendee_id) REFERENCES activitytpresence (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE activity DROP emergency');
|
||||
$this->addSql('ALTER TABLE activity DROP CONSTRAINT FK_AC74095ABCFD782A');
|
||||
$this->addSql('ALTER TABLE activity ADD attendee BOOLEAN DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE activity DROP attendee_id');
|
||||
$this->addSql('ALTER TABLE activity DROP sentReceived');
|
||||
|
||||
$this->addSql('DROP SEQUENCE activitytpresence_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE activitytpresence');
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20210422123846 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('CREATE TABLE activity_person (activity_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(activity_id, person_id))');
|
||||
$this->addSql('CREATE INDEX IDX_66AA317681C06096 ON activity_person (activity_id)');
|
||||
$this->addSql('CREATE INDEX IDX_66AA3176217BBB47 ON activity_person (person_id)');
|
||||
$this->addSql('CREATE TABLE activity_thirdparty (activity_id INT NOT NULL, thirdparty_id INT NOT NULL, PRIMARY KEY(activity_id, thirdparty_id))');
|
||||
$this->addSql('CREATE INDEX IDX_C6F0DE0381C06096 ON activity_thirdparty (activity_id)');
|
||||
$this->addSql('CREATE INDEX IDX_C6F0DE03C7D3A8E6 ON activity_thirdparty (thirdparty_id)');
|
||||
$this->addSql('CREATE TABLE activity_document (activity_id INT NOT NULL, document_id INT NOT NULL, PRIMARY KEY(activity_id, document_id))');
|
||||
$this->addSql('CREATE INDEX IDX_78633A7881C06096 ON activity_document (activity_id)');
|
||||
$this->addSql('CREATE INDEX IDX_78633A78C33F7837 ON activity_document (document_id)');
|
||||
$this->addSql('CREATE TABLE activity_user (activity_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(activity_id, user_id))');
|
||||
$this->addSql('CREATE INDEX IDX_8E570DDB81C06096 ON activity_user (activity_id)');
|
||||
$this->addSql('CREATE INDEX IDX_8E570DDBA76ED395 ON activity_user (user_id)');
|
||||
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA317681C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_person ADD CONSTRAINT FK_66AA3176217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE0381C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_thirdparty ADD CONSTRAINT FK_C6F0DE03C7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A7881C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
#$this->addSql('ALTER TABLE activity_document ADD CONSTRAINT FK_78633A78C33F7837 FOREIGN KEY (document_id) REFERENCES Document (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDB81C06096 FOREIGN KEY (activity_id) REFERENCES activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_user ADD CONSTRAINT FK_8E570DDBA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('ALTER TABLE activity ADD travelTime TIME(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||
|
||||
$this->addSql('ALTER TABLE activitytype ADD travelTimeVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD travelTimeLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD usersVisible SMALLINT DEFAULT 1 NOT NULL');
|
||||
$this->addSql('ALTER TABLE activitytype ADD usersLabel VARCHAR(255) DEFAULT \'\' NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('DROP TABLE activity_person');
|
||||
$this->addSql('DROP TABLE activity_thirdparty');
|
||||
$this->addSql('DROP TABLE activity_document');
|
||||
$this->addSql('DROP TABLE activity_user');
|
||||
|
||||
$this->addSql('ALTER TABLE activity DROP travelTime');
|
||||
|
||||
$this->addSql('ALTER TABLE activitytype DROP travelTimeVisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP travelTimeLabel');
|
||||
$this->addSql('ALTER TABLE activitytype DROP usersVisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP usersLabel');
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ trait PrepareClientTrait
|
||||
* @return \Symfony\Component\BrowserKit\Client
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function getClient(
|
||||
public function getClientAuthenticated(
|
||||
$username = 'center a_social',
|
||||
$password = 'password'
|
||||
) {
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class DefaultControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -45,11 +45,6 @@ class ExportManagerTest extends KernelTestCase
|
||||
use \Chill\MainBundle\Test\PrepareUserTrait;
|
||||
use \Chill\MainBundle\Test\PrepareScopeTrait;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -65,8 +60,6 @@ class ExportManagerTest extends KernelTestCase
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->container = self::$kernel->getContainer();
|
||||
|
||||
$this->prophet = new \Prophecy\Prophet;
|
||||
}
|
||||
|
||||
@ -97,7 +90,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
\Symfony\Component\Security\Core\User\UserInterface $user = null
|
||||
)
|
||||
{
|
||||
$localUser = $user === NULL ? $this->container->get('doctrine.orm.entity_manager')
|
||||
$localUser = $user === NULL ? self::$container->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillMainBundle:User')
|
||||
->findOneBy(array('username' => 'center a_social')) :
|
||||
$user;
|
||||
@ -106,10 +99,10 @@ class ExportManagerTest extends KernelTestCase
|
||||
$tokenStorage->setToken($token);
|
||||
|
||||
return new ExportManager(
|
||||
$logger === NULL ? $this->container->get('logger') : $logger,
|
||||
$em === NULL ? $this->container->get('doctrine.orm.entity_manager') : $em,
|
||||
$authorizationChecker === NULL ? $this->container->get('security.authorization_checker') : $authorizationChecker,
|
||||
$authorizationHelper === NULL ? $this->container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
||||
$logger === NULL ? self::$container->get('logger') : $logger,
|
||||
$em === NULL ? self::$container->get('doctrine.orm.entity_manager') : $em,
|
||||
$authorizationChecker === NULL ? self::$container->get('security.authorization_checker') : $authorizationChecker,
|
||||
$authorizationHelper === NULL ? self::$container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
||||
$tokenStorage)
|
||||
;
|
||||
}
|
||||
@ -544,7 +537,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
|
||||
$export = $this->prophet->prophesize();
|
||||
$export->willImplement(ExportInterface::class);
|
||||
$em = $this->container->get('doctrine.orm.entity_manager');
|
||||
$em = self::$container->get('doctrine.orm.entity_manager');
|
||||
$export->initiateQuery(
|
||||
Argument::is(array('foo')),
|
||||
Argument::Type('array'),
|
||||
@ -627,7 +620,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
|
||||
//add formatter interface
|
||||
$formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter(
|
||||
$this->container->get('translator'), $exportManager);
|
||||
self::$container->get('translator'), $exportManager);
|
||||
$exportManager->addFormatter($formatter, 'spreadsheet');
|
||||
|
||||
//ob_start();
|
||||
|
@ -42,7 +42,37 @@ use Chill\MainBundle\Entity\User;
|
||||
*/
|
||||
class AccompanyingPeriod
|
||||
{
|
||||
const INTENSITY = ['occasional', 'regular'];
|
||||
/**
|
||||
* Mark an accompanying period as "occasional"
|
||||
*
|
||||
* used in INTENSITY
|
||||
*/
|
||||
public const INTENSITY_OCCASIONAL = 'occasional';
|
||||
|
||||
/**
|
||||
* Mark an accompanying period as "regular"
|
||||
*
|
||||
* used in INTENSITY
|
||||
*/
|
||||
public const INTENSITY_REGULAR = 'regular';
|
||||
|
||||
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
|
||||
|
||||
/**
|
||||
* Mark an accompanying period as "draft".
|
||||
*
|
||||
* This means that the accompanying period is not yet
|
||||
* confirmed by the creator
|
||||
*/
|
||||
public const STEP_DRAFT = 'DRAFT';
|
||||
|
||||
/**
|
||||
* Mark an accompanying period as "confirmed".
|
||||
*
|
||||
* This means that the accompanying period **is**
|
||||
* confirmed by the creator
|
||||
*/
|
||||
public const STEP_CONFIRMED = 'CONFIRMED';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
@ -117,7 +147,7 @@ class AccompanyingPeriod
|
||||
* @var string
|
||||
* @ORM\Column(type="string", length=32, nullable=true)
|
||||
*/
|
||||
private $step = 'DRAFT';
|
||||
private $step = self::STEP_DRAFT;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Origin::class)
|
||||
|
@ -47,7 +47,7 @@ class ClosingMotive
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @ORM\Column(type="json_array")
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Origin
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $label;
|
||||
|
||||
|
@ -50,7 +50,7 @@ class AccompanyingPeriodParticipation
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations")
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"})
|
||||
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
private $accompanyingPeriod;
|
||||
|
@ -123,7 +123,8 @@ class PersonType extends AbstractType
|
||||
'label' => false,
|
||||
'delete_empty' => function(PersonPhone $pp = null) {
|
||||
return NULL === $pp || $pp->isEmpty();
|
||||
}
|
||||
},
|
||||
'error_bubbling' => false
|
||||
]);
|
||||
|
||||
if ($this->config['email'] === 'visible') {
|
||||
|
@ -85,6 +85,7 @@
|
||||
{%- endif -%}
|
||||
{%- if form.otherPhoneNumbers is defined -%}
|
||||
{{ form_widget(form.otherPhoneNumbers) }}
|
||||
{{ form_errors(form.otherPhoneNumbers) }}
|
||||
{%- endif -%}
|
||||
{%- if form.contactInfo is defined -%}
|
||||
{{ form_row(form.contactInfo, {'label': 'Notes on contact information'}) }}
|
||||
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Rename sequence "closing motive"
|
||||
*/
|
||||
final class Version20210419105054 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'rename sequence "closing motive"';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive_id_seq RENAME TO '
|
||||
. 'chill_person_accompanying_period_closingmotive_id_seq');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive_id_seq '
|
||||
. 'RENAME TO chill_person_closingmotive_id_seq');
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* set label for origin as json
|
||||
*/
|
||||
final class Version20210419105940 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'set label for origin as json';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label TYPE JSON USING json_build_object(\'fr\', label)::jsonb');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label DROP DEFAULT');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
// this will keep the '"' at first and last character, but is acceptable
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label TYPE VARCHAR(255) USING label->\'fr\'::text');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label DROP DEFAULT');
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* fix deprecated json array
|
||||
*/
|
||||
final class Version20210419112619 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'fix deprecated json_array';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_closingmotive.name IS NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_closingmotive.name IS \'(DC2Type:json_array)\'');
|
||||
}
|
||||
}
|
@ -89,7 +89,7 @@ class LoadReports extends AbstractFixture implements OrderedFixtureInterface, Co
|
||||
{
|
||||
$charline = $this->container->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillPersonBundle:Person')
|
||||
->findOneBy(array('lastName' => 'Charline'))
|
||||
->findOneBy(array('firstName' => 'Charline', 'lastName' => 'Depardieu'))
|
||||
;
|
||||
|
||||
$report = (new Report())
|
||||
|
1
tests/app
Submodule
1
tests/app
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5321a3a4506f8db0f143909be307ed068e15df9c
|
Loading…
x
Reference in New Issue
Block a user