Skip to content

Commit c75bcb2

Browse files
authored
Merge pull request #25 from itk-dev/feature/ITSTYR-81_symfony6upgrade
feature/ITSTYR 81 symfony6upgrade
2 parents 5383a3a + a840769 commit c75bcb2

204 files changed

Lines changed: 9561 additions & 9765 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/data/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore
5+
!Readme.md

.docker/data/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .docker/data
2+
3+
Please map persistent volumes to this directory on the servers.
4+
5+
If a container needs to persist data between restarts you can map the relevant files in the container to ``docker/data/<container-name>`.
6+
7+
## RabbitMQ example
8+
If you are using RabbitMQ running in a container as a message broker you need to configure a persistent volume for RabbitMQs data directory to avoid losing message on container restarts.
9+
10+
```yaml
11+
# docker-compose.server.override.yml
12+
13+
services:
14+
rabbit:
15+
image: rabbitmq:3.9-management-alpine
16+
hostname: "${COMPOSE_PROJECT_NAME}"
17+
networks:
18+
- app
19+
- frontend
20+
environment:
21+
- "RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}"
22+
- "RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}"
23+
- "RABBITMQ_ERLANG_COOKIE=${RABBITMQ_ERLANG_COOKIE}"
24+
volumes:
25+
- ".docker/data/rabbitmq:/var/lib/rabbitmq/mnesia/"
26+
```

.docker/vhost.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ server {
99
}
1010

1111
location ~ ^/index\.php(/|$) {
12+
fastcgi_buffers 16 32k;
13+
fastcgi_buffer_size 64k;
14+
fastcgi_busy_buffers_size 64k;
15+
1216
fastcgi_pass phpfpm:9000;
1317
fastcgi_split_path_info ^(.+\.php)(/.*)$;
1418
include fastcgi_params;

.env

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ MAILER_URL=smtp://mailhog:1025
2222
###< symfony/swiftmailer-bundle ###
2323

2424
###> doctrine/doctrine-bundle ###
25-
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
26-
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
27-
# Configure your db driver and server_version in config/packages/doctrine.yaml
28-
DATABASE_URL=mysql://db:db@mariadb:3306/db
25+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
26+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
27+
#
28+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
29+
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
30+
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
31+
# DATABASE_URL=mysql://db:db@mariadb:3306/db
32+
DATABASE_URL="mysql://db:db@mariadb:3306/db?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
2933
###< doctrine/doctrine-bundle ###
3034

3135
###> fos/fos-user-bundle ###

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

.gitignore

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1+
### IDE ###
2+
.idea
3+
## IDE ###
14
###> symfony/framework-bundle ###
5+
/.env.local
6+
/.env.local.php
7+
/.env.*.local
8+
/config/secrets/prod/prod.decrypt.private.php
29
/public/bundles/
310
/var/
411
/vendor/
12+
/testdata/
513
###< symfony/framework-bundle ###
614

7-
###> symfony/webpack-encore-pack ###
8-
/node_modules/
9-
/public/build/
10-
npm-debug.log
11-
yarn-error.log
12-
###< symfony/webpack-encore-pack ###
13-
1415
###> symfony/phpunit-bridge ###
15-
.phpunit
16+
.phpunit.result.cache
1617
/phpunit.xml
1718
###< symfony/phpunit-bridge ###
1819

19-
###> symfony/web-server-bundle ###
20-
/.web-server-pid
21-
###< symfony/web-server-bundle ###
20+
### <Coding standard> ###
21+
.php-cs-fixer.cache
22+
### <Coding standard> ###
23+
24+
### OTHER ###
25+
###> friendsofphp/php-cs-fixer ###
26+
/.php-cs-fixer.php
27+
/.php-cs-fixer.cache
28+
###< friendsofphp/php-cs-fixer ###

.php-cs-fixer.dist.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude(['var', 'vendor', 'node_modules'])
6+
7+
;
8+
9+
return (new PhpCsFixer\Config())
10+
->setRules([
11+
'@Symfony' => true,
12+
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
13+
// @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/import/ordered_imports.rst
14+
'ordered_imports' => ['imports_order' => ['const', 'class', 'function']],
15+
])
16+
17+
->setFinder($finder)
18+
;

.php-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,93 @@ Styringsværktøj til IT projekter
33

44
## Setup locally
55

6+
### Preset
7+
Make sure you have a set of JSON files for testing import Commands.
8+
69
### Start Docker containers
710

811
```sh
9-
docker-compose up -d
10-
docker-compose exec phpfpm composer install
11-
docker-compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
12+
docker compose up -d
13+
docker compose exec phpfpm composer install
14+
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
1215
```
1316

1417
### Create a super admin user
1518

1619
```sh
17-
docker-compose exec phpfpm bin/console fos:user:create --super-admin
20+
docker compose exec phpfpm bin/console SuperUser
1821
```
1922

2023
### Access the site
2124

2225
You should now be able to browse to the application
2326

2427
```
25-
open http://$(docker-compose port nginx 80)
28+
29+
open "http://$(docker-compose port nginx 8080)"
30+
2631
```
2732

2833
## Import systems and reports
2934
```sh
30-
bin/console itstyr:import:system PATH
31-
bin/console itstyr:import:report PATH
35+
docker compose exec phpfpm bin/console itstyr:import:system PATH
36+
docker compose exec phpfpm bin/console itstyr:import:report PATH
37+
```
38+
39+
### Flowchart
40+
41+
A helpful flowchart over the Entities, and Joinedtables.
42+
Ilustrative figures meaning:
43+
1. Database = Database
44+
2. Black square = Entities
45+
3. Grey square = relations
46+
4. Hexagon = Joinedtables
47+
5. arrow = relation between DB and Entity
48+
6. bulletin = shows the mapping Entities in Jointables, and JoinCollums
49+
50+
```mermaid
51+
flowchart TD
52+
Answers[Answers]
53+
Category[Category]
54+
Group[Group]
55+
ImportRun[ImportrRun]
56+
Question[Question]
57+
Report[Report]
58+
SelServiceAFI[SelServiceAFI]
59+
System[System]
60+
Theme[Theme]
61+
ThemeCategory[ThemeCategory]
62+
User[User]
63+
64+
fos_user_user_group{{JoinTable: fos_user_user_group }}
65+
group_system_themes{{JoinTable: group_system_themes }}
66+
group_report_themes{{JoinTable: group_report_themes }}
67+
68+
Database[(Database)] --> Answers & Category & Group & ImportRun & Question & Report & SelServiceAFI & System & Theme & ThemeCategory & User
69+
70+
User---|ManyToMany| Group
71+
User -- JoinTable User and Group --o fos_user_user_group
72+
73+
Group---|ManyToMany| Report
74+
Group---|ManyToMany| System
75+
Group---|ManyToMany| Theme
76+
Group -- JoinTable Theme and Group --o group_system_themes
77+
Group---|ManyToMany| Theme
78+
Group -- JoinTable Theme and Group --o group_report_themes
79+
80+
Report --- |ManyToOne| Answers
81+
82+
System --- |ManyToOne| Answers
83+
System --- |ManyToMany| SelServiceAFI
84+
85+
Theme --- |ManyToOne| ThemeCategory
86+
87+
Answers --- |ManyToOne| Question
88+
Question -- JoinCollum Answers and Question --o Answers
89+
90+
ThemeCategory --- |ManyToOne| Category
91+
Category -- JoinCollum ThemeCategory and Category --o ThemeCategory
92+
93+
Question --- |ManyToOne| Category
3294
```
95+

bin/console

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,19 @@
33

44
use App\Kernel;
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
6-
use Symfony\Component\Console\Input\ArgvInput;
7-
use Symfony\Component\Debug\Debug;
8-
use Symfony\Component\Dotenv\Dotenv;
96

10-
set_time_limit(0);
11-
12-
require __DIR__.'/../vendor/autoload.php';
13-
14-
if (!class_exists(Application::class)) {
15-
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
7+
if (!is_dir(dirname(__DIR__).'/vendor')) {
8+
throw new LogicException('Dependencies are missing. Try running "composer install".');
169
}
1710

18-
if (!isset($_SERVER['APP_ENV'])) {
19-
if (!class_exists(Dotenv::class)) {
20-
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
21-
}
22-
(new Dotenv())->load(__DIR__.'/../.env');
11+
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
12+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
2313
}
2414

25-
$input = new ArgvInput();
26-
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
27-
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);
15+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
2816

29-
if ($debug) {
30-
umask(0000);
31-
32-
if (class_exists(Debug::class)) {
33-
Debug::enable();
34-
}
35-
}
17+
return function (array $context) {
18+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
3619

37-
$kernel = new Kernel($env, $debug);
38-
$application = new Application($kernel);
39-
$application->run($input);
20+
return new Application($kernel);
21+
};

0 commit comments

Comments
 (0)