1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

upgrade all, add migration from framadate v1

This commit is contained in:
Tykayn 2021-04-20 16:14:34 +02:00 committed by tykayn
parent 109e7a35d6
commit 21c594a2fd
71 changed files with 4179 additions and 4152 deletions

9
.env
View File

@ -32,11 +32,6 @@ WEBSITE_LOGO=logo.svg
# IMPORTANT: You MUST also configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://framadate-admin:framadate-admin-password@127.0.0.1:3306/framadate_api
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN=^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$
###< nelmio/cors-bundle ###
###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
@ -45,7 +40,3 @@ MAILER_URL=sendmail://YOUR_WEBSITE
# set the support email who will answer users in case of emergency
SUPPORT_EMAIL=YOUR_EMAIL
###< symfony/swiftmailer-bundle ###
###> symfony/mailer ###
MAILER_DSN=smtp://localhost
###< symfony/mailer ###

9
.gitignore vendored
View File

@ -1,4 +1,3 @@
###> symfony/framework-bundle ###
.env.local
/.env.local.php
@ -41,12 +40,4 @@ public/*
###< symfony/phpunit-bridge ###
node_modules
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
funky-framadate-front

View File

@ -1,5 +1,5 @@
#Funky Framadate API
Experimental REST backend in symfony 4 for Funky framadate frontend.
Experimental REST backend in symfony 5 for Funky framadate frontend.
https://framagit.org/framasoft/framadate/funky-framadate-front
Follow this guide to setup.
@ -14,7 +14,7 @@ return stack of votes when we want to get the configuration of one poll (see [do
***
### Requirements
You MUST have php version 7+ and [Composer](https://getcomposer.org/download/), and a database like Mysql, or postgresql, or mongodb, or any database that Doctrine can handle.
You MUST have php version 8+ and [Composer](https://getcomposer.org/download/), and a database like Mysql, or postgresql, or mongodb, or any database that Doctrine can handle.
Setup access to database by creating a .env.local file, and fill the database user and password data.
you can check that the database connection works with the command:
```bash
@ -37,8 +37,10 @@ composer check-platform-reqs
### install the vendors
```bash
composer install
```#Funky Framadate API
Experimental REST backend in symfony 4 for Funky framadate frontend.
```
#Funky Framadate API
Experimental REST backend in symfony 5 for Funky framadate frontend.
https://framagit.org/framasoft/framadate/funky-framadate-front
Follow this guide to setup.
@ -53,7 +55,7 @@ return stack of votes when we want to get the configuration of one poll (see [do
***
### Requirements
You MUST have php version 7+ and [Composer](https://getcomposer.org/download/), and a database like Mysql, or postgresql, or mongodb, or any database that Doctrine can handle.
You MUST have php version 8+ and [Composer](https://getcomposer.org/download/), and a database like Mysql, or postgresql, or mongodb, or any database that Doctrine can handle.
Setup access to database by creating a .env.local file, and fill the database user and password data.
you can check that the database connection works with the command:
```bash
@ -125,6 +127,5 @@ made by B. Lemoine, aka Tykayn, for the framadate funky front end project, a pol
## contacts
* contact@cipherbliss.com
* https://mastodon.cipherbliss.com/@tykayn
* https://keybase.io/tykayn
* https://twitter.com/tykayn
* https://cipherbliss.com

View File

@ -1,14 +0,0 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.scss';
// Need jQuery? Install it with "yarn add jquery", then uncomment to import it.
// import $ from 'jquery';
console.log('Hello Webpack Encore! Edit me in assets/app.js');

View File

@ -4,18 +4,19 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
@ -27,7 +28,7 @@ if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);

69
composer.json Executable file → Normal file
View File

@ -1,48 +1,33 @@
{
"type": "project",
"license": "AGPLv3",
"license": "proprietary",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.1.3",
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-pdo_mysql": "*",
"friendsofsymfony/rest-bundle": "^2.6",
"jms/serializer-bundle": "^3.4",
"nelmio/api-doc-bundle": "^4.0",
"nelmio/cors-bundle": "^2.0",
"overblog/graphql-bundle": "^0.13.4",
"sensio/framework-extra-bundle": "^5.5",
"swiftmailer/swiftmailer": "^6.0",
"symfony/config": "4.3.*",
"symfony/console": "4.3.*",
"symfony/dependency-injection": "4.3.*",
"symfony/dotenv": "4.3.*",
"symfony/expression-language": "4.3.*",
"composer/package-versions-deprecated": "1.11.99.1",
"doctrine/annotations": "^1.12",
"doctrine/doctrine-bundle": "^2.3",
"doctrine/doctrine-migrations-bundle": "^3.1",
"doctrine/orm": "^2.8",
"friendsofsymfony/rest-bundle": "^3.0",
"jms/serializer-bundle": "^3.9",
"sensio/framework-extra-bundle": "^6.1",
"symfony/asset": "5.2.*",
"symfony/console": "5.2.*",
"symfony/dotenv": "5.2.*",
"symfony/flex": "^1.3.1",
"symfony/form": "4.3.*",
"symfony/framework-bundle": "4.3.*",
"symfony/intl": "4.3.*",
"symfony/mailer": "4.3.*",
"symfony/maker-bundle": "^1.14",
"symfony/orm-pack": "^1.0",
"symfony/security-csrf": "4.3.*",
"symfony/swiftmailer-bundle": "^3.4",
"symfony/twig-bundle": "4.3.*",
"symfony/validator": "4.3.*",
"symfony/webpack-encore-bundle": "^1.7",
"symfony/yaml": "4.3.*"
},
"require-dev": {
"ext-mbstring": "*",
"ext-pdo_sqlite": "*",
"doctrine/doctrine-fixtures-bundle": "^3.2",
"liip/test-fixtures-bundle": "^1.0.0",
"symfony/browser-kit": "4.3.*",
"symfony/phpunit-bridge": "^5.0",
"symfony/web-server-bundle": "4.3.*"
"symfony/form": "5.2.*",
"symfony/framework-bundle": "5.2.*",
"symfony/proxy-manager-bridge": "5.2.*",
"symfony/swiftmailer-bundle": "^3.5",
"symfony/twig-bundle": "5.2.*",
"symfony/yaml": "5.2.*"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
@ -59,12 +44,9 @@
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
@ -84,7 +66,10 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.3.*"
"require": "5.2.*"
}
},
"require-dev": {
"symfony/maker-bundle": "^1.30"
}
}

5436
composer.lock generated Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

15
config/bundles.php Executable file → Normal file
View File

@ -2,19 +2,12 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Liip\TestFixturesBundle\LiipTestFixturesBundle::class => ['test' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Overblog\GraphQLBundle\OverblogGraphQLBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
];

View File

@ -1,3 +0,0 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

6
config/packages/cache.yaml Executable file → Normal file
View File

@ -1,10 +1,10 @@
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The app cache caches to the filesystem by default.
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis

0
config/packages/dev/jms_serializer.yaml Executable file → Normal file
View File

2
config/packages/dev/swiftmailer.yaml Executable file → Normal file
View File

@ -1,4 +1,4 @@
# See https://symfony.com/doc/current/email/dev_environment.html
swiftmailer:
# send all emails to a specific address
# delivery_addresses: ['contact@cipherbliss.com']
#delivery_addresses: ['me@example.com']

19
config/packages/doctrine.yaml Executable file → Normal file
View File

@ -1,21 +1,14 @@
doctrine:
dbal:
# configure these for your database server
# use postgresql for PostgreSQL
# use sqlite for SQLite
driver: 'mysql_pdo'
server_version: '8.0.22'
# only needed for MySQL
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
override_url: true
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:

5
config/packages/doctrine_migrations.yaml Executable file → Normal file
View File

@ -1,5 +1,6 @@
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
namespace: DoctrineMigrations
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: '%kernel.debug%'

31
config/packages/fos_rest.yaml Executable file → Normal file
View File

@ -1,18 +1,15 @@
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
fos_rest:
# param_fetcher_listener: true
# allowed_methods_listener: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
routing_loader: true
format_listener:
rules:
- { path: '^/',
prefer_extension: true,
fallback_format: json,
priorities: [ json, html ] }
fos_rest: null
# param_fetcher_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
# format_listener:
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }

1
config/packages/framework.yaml Executable file → Normal file
View File

@ -1,3 +1,4 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true

View File

@ -1,10 +0,0 @@
overblog_graphql:
definitions:
schema:
query: Query
mappings:
types:
-
type: yaml
dir: "%kernel.project_dir%/config/graphql/types"
suffix: null

0
config/packages/jms_serializer.yaml Executable file → Normal file
View File

View File

@ -1,3 +0,0 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

View File

@ -1,9 +0,0 @@
nelmio_api_doc:
documentation:
info:
title: Poll Bliss
description: Sondages à la framadate par CipherBliss
version: 1.0.0
areas: # to filter documented areas
path_patterns:
- ^/api(?!/doc$) # Accepts routes under /api except /api/doc

View File

@ -1,15 +0,0 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': null
'^/api/':
allow_origin: ['*']
allow_headers: ['Content-Type', 'Authorization']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
max_age: 3600

24
config/packages/prod/doctrine.yaml Executable file → Normal file
View File

@ -2,26 +2,14 @@ doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: service
id: doctrine.system_cache_provider
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: service
id: doctrine.system_cache_provider
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: service
id: doctrine.result_cache_provider
services:
doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.result_cache_pool'
doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.system_cache_pool'
type: pool
pool: doctrine.result_cache_pool
framework:
cache:

0
config/packages/prod/jms_serializer.yaml Executable file → Normal file
View File

0
config/packages/prod/routing.yaml Executable file → Normal file
View File

View File

@ -1,4 +0,0 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

4
config/packages/routing.yaml Executable file → Normal file
View File

@ -1,3 +1,7 @@
framework:
router:
utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

2
config/packages/sensio_framework_extra.yaml Executable file → Normal file
View File

@ -1,5 +1,3 @@
sensio_framework_extra:
router:
annotations: false
request:
converters: true

0
config/packages/swiftmailer.yaml Executable file → Normal file
View File

12
config/packages/test/doctrine.yaml Executable file → Normal file
View File

@ -1,5 +1,7 @@
doctrine:
dbal:
driver: pdo_sqlite
path: "%kernel.cache_dir%/test.db"
url: null
#doctrine:
# dbal:
# # Overrides the database name in the test environment only
# # "host", "port", "username", & "password" can also be set to override their respective url parts
# #
# # If you're using ParaTest, "TEST_TOKEN" is set by ParaTest otherwise nothing is appended to the database name.
# dbname: main_test%env(default::TEST_TOKEN)%

3
config/packages/test/framework.yaml Executable file → Normal file
View File

@ -2,6 +2,3 @@ framework:
test: true
session:
storage_id: session.storage.mock_file
liip_test_fixtures:
cache_db:
sqlite: liip_test_fixtures.services_database_backup.sqlite

0
config/packages/test/swiftmailer.yaml Executable file → Normal file
View File

0
config/packages/test/twig.yaml Executable file → Normal file
View File

View File

@ -1,3 +0,0 @@
framework:
validation:
not_compromised_password: false

View File

@ -1,2 +0,0 @@
#webpack_encore:
# strict_mode: false

6
config/packages/twig.yaml Executable file → Normal file
View File

@ -1,8 +1,2 @@
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
globals:
BASE_URL: '%env(BASE_URL)%'
WEBSITE_NAME: '%env(WEBSITE_NAME)%'
WEBSITE_LOGO: '%env(WEBSITE_LOGO)%'

View File

@ -1,8 +0,0 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

View File

@ -1,25 +0,0 @@
webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# if using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# preload all rendered script and link tags automatically via the http2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# if you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
# frontend: '%kernel.project_dir%/public/frontend/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true

5
config/preload.php Normal file
View File

@ -0,0 +1,5 @@
<?php
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}

0
config/routes.yaml Executable file → Normal file
View File

4
config/routes/annotations.yaml Executable file → Normal file
View File

@ -1,3 +1,7 @@
controllers:
resource: ../../src/Controller/
type: annotation
kernel:
resource: ../../src/Kernel.php
type: annotation

View File

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -1,3 +0,0 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -1,3 +0,0 @@
overblog_graphql_endpoint:
resource: "@OverblogGraphQLBundle/Resources/config/routing/graphql.yml"
prefix: api/graphql

View File

@ -1,12 +0,0 @@
# Expose your documentation as JSON swagger compliant
app.swagger:
path: /api/doc.json
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger }
## Requires the Asset component and the Twig bundle
## $ composer require twig asset
#app.swagger_ui:
# path: /api/doc
# methods: GET
# defaults: { _controller: nelmio_api_doc.controller.swagger_ui }

17
config/services.yaml Executable file → Normal file
View File

@ -4,8 +4,10 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
admin_token: '%env(resolve:ADMIN_TOKEN)%'
OLD_DATABASE_NAME: '%env(OLD_DATABASE_NAME)%'
OLD_DATABASE_USER: '%env(OLD_DATABASE_USER)%'
OLD_DATABASE_PASS: '%env(OLD_DATABASE_PASS)%'
UNIQ_INSTALL_KEY: '%env(UNIQ_INSTALL_KEY)%'
services:
# default configuration for services in *this* file
_defaults:
@ -15,15 +17,18 @@ services:
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
resource: '../src/Controller/'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
Doctrine\ORM\EntityManager: "@doctrine.orm.default_entity_manager"

15
doc/evolutions.md Executable file
View File

@ -0,0 +1,15 @@
# Évolutions
Après avoir modifié le modèle de données dans les Entity, lancez la commande pour mettre à jour les getter et setters
```bash
php bin/console make:entity --regenerate
```
et pour mettre à jour le schéma en base de données
```bash
php bin/console doctrine:schema:update --force
```
# Ressources
les types de champ Doctrine:
https://www.doctrine-project.org/projects/doctrine-orm/en/2.8/reference/basic-mapping.html#doctrine-mapping-types

16
doc/migration.md Normal file
View File

@ -0,0 +1,16 @@
# Migration depuis la version 1 de Framadate
Cela va importer vos anciens sondages dans les tables de la nouvelle version.
* Remplissez les accès en base de données concernant la version 1 de Framadate dans votre fichier [.env](../.env) à la racine de ce dossier.
* Choisissez une chaine unique dans votre fichier .env à la place de superCaliFragilistiExpialidousiousse
* Une fois votre application accessible via navigateur, rendez vous sur votre point d'accès web à l'addresse /migration-from-v1/superCaliFragilistiExpialidousiousse en changeant __superCaliFragilistiExpialidousiousse__ par votre variable unique.
* tadam, vous aurez un message indiquant si vous avez réussi la migration.
## Comparaison de schémas
pour information, voici les schémas des bases de données des deux versions:
### Ancien
![old](../public/assets/img/framadate_v1_schema.svg)
### Nouveau
![old](../public/assets/img/framadate_funky_schema.svg)

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210419202522 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
}
}

View File

@ -1,40 +0,0 @@
{
"name": "date-poll-api",
"version": "1.0.0",
"description": "API date to make surveys, kind of the new Framadate",
"main": "index.js",
"directories": {
"doc": "doc",
"test": "tests"
},
"dependencies": {
"@symfony/webpack-encore": "^0.31.0",
"font-awesome": "^4.7.0",
"tailwindcss": "^1.9.6"
},
"devDependencies": {
"node-sass": "^4.14.1",
"sass-loader": "^9.0.0",
"webpack-notifier": "1.6.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"repository": {
"type": "git",
"url": "https://framagit.org/tykayn/date-poll-api.git"
},
"keywords": [
"survey",
"poll",
"sondage",
"api",
"symfony"
],
"author": "tykayn",
"license": "AGPL-3.0-or-later"
}

15
public/index.php Executable file → Normal file
View File

@ -1,10 +1,13 @@
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
@ -12,14 +15,6 @@ if ($_SERVER['APP_DEBUG']) {
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);

0
src/Controller/.gitignore vendored Executable file → Normal file
View File

View File

@ -0,0 +1,235 @@
<?php
namespace App\Controller;
//use FOS\RestBundle\Controller\Annotations\Get;
//use FOS\RestBundle\Controller\Annotations\Route;
use App\Entity\Choice;
use App\Entity\Comment;
use App\Entity\StackOfVotes;
use App\Entity\Vote;
use App\Repository\PollRepository;
use App\Service\MailService;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\Annotations\Route;
use JMS\Serializer\Type\Exception\Exception;
use Symfony\Component\HttpFoundation\JsonResponse;
use App\Entity\Owner;
use App\Entity\Poll;
/**
* Class DefaultController
* @package App\Controller
* @Route("/migration-from-v1",name="admin_homepage")
*/
class MigrationController extends FramadateController {
/**
* @Get(path ="/{unique_key}",
* name = "_migrate_from_v1")
*/
public function indexAction( $unique_key ) {
// get env vars
// check uniq key is good
if ( $unique_key !== $this->getParameter( 'UNIQ_INSTALL_KEY' ) ) {
return new JsonResponse( [
'error' => 'NOPE! veuillez vérifier votre fichier .env',
] );
};
// fetch old Database
$debug = '';
$em = $this->getDoctrine()->getManager();
$pollsBySlug = [];
$pdo_options[ \PDO::ATTR_ERRMODE ] = \PDO::ERRMODE_EXCEPTION;
$bdd = new \PDO( 'mysql:host=localhost;dbname=' . $this->getParameter( 'OLD_DATABASE_NAME' ),
$this->getParameter( 'OLD_DATABASE_USER' ),
$this->getParameter( 'OLD_DATABASE_PASS' ),
$pdo_options );
$res_polls = $bdd->query( 'SELECT * FROM fd_poll' );
while ( $d = $res_polls->fetch( \PDO::FETCH_OBJ ) ) {
$debug .= " <br> ajout de sondage : ".$d->title .' - '. $d->id ;
$newPoll = new Poll();
$owner = new Owner();
$owner->setEmail( $d->admin_mail )
->setPseudo( $d->admin_name )
->addPoll($newPoll);
$newPoll
->setOwner( $owner )
->setCustomURL( $d->id )
->setKind( $d->id === 'D' ? 'date' : 'text' )
->setHideResults( ! $d->results_publicly_visible )
->setAdminKey( $d->admin_id )
->setTitle( $d->title )
->setVotesAllowed( $d->receiveNewVotes )
->setCommentsAllowed( $d->receiveNewComments )
->setChoicesMax( $d->ValueMax )
->setPassword( $d->password_hash )
->setDescription( $d->description )
->setCreationDate( date_create( $d->creation_date ) );
$pollsBySlug[ $d->id ] = $newPoll;
$em->persist( $owner );
$em->persist( $newPoll );
}
// get choices, slots and link them with poll by their slug
$res_slots = $bdd->query( 'SELECT * FROM fd_slot' );
$pollChoicesOrderedBySlug = [];
$choicesCreated = [];
while ( $d = $res_slots->fetch( \PDO::FETCH_OBJ ) ) {
$debug .= " <br> ajout de slot, converti en choix de réponse : ".$d->poll_id. ' : '. $d->moments;
$pollSlug = $d->poll_id;
$poll = $pollsBySlug[$pollSlug];
$moments = explode(',' , $d->moments);
foreach ( $moments as $moment ) {
$newChoice = new Choice();
$newChoice
->setPoll($poll)
->setDateTime(date_create( strtotime( $d->title)))
->setName($moment);
$pollChoicesOrderedBySlug[$pollSlug][] = $newChoice;
$poll->addChoice($newChoice);
$em->persist( $newChoice );
$em->persist( $newPoll );
$choicesCreated[] = $newChoice;
}
}
// get votes
$stacksOfVote = [];
$res_votes = $bdd->query( 'SELECT * FROM fd_vote' );
while ( $d = $res_votes->fetch( \PDO::FETCH_OBJ ) ) {
$debug .= " <br> ajout de stack de vote : ".$d->name;
$pollSlug = $d->poll_id;
$poll = $pollsBySlug[ $pollSlug ];
$newStack = new StackOfVotes();
$newOwner = new Owner();
$newOwner
->setPseudo($d->name)
->setEmail('the_anonymous_email_from_@_migration_offramadate.org')
->setModifierToken($d->uniqId)
;
$newStack->setPoll($poll)
->setOwner($newOwner)
->setPseudo($d->name)
;
// each choice answer is encoded in a value :
$voteCodes = str_split($d->choices);
// get choices of the poll and answer accordingly
$ii=0;
foreach ( $voteCodes as $vote_code ) {
if($vote_code !== ' '){
$choice = $pollChoicesOrderedBySlug[$pollSlug][$ii];
$newVote = new Vote();
$newVote
->setChoice($choice)
->setStacksOfVotes($newStack)
->setPoll($poll)
->setValue( $this->mapAnswerNumberToWord($vote_code))
;
$newStack->addVote($newVote);
$em->persist( $newVote );
$votes[] = $newVote;
}
$ii++;
}
$poll->addStackOfVote($newStack);
$em->persist( $newStack );
$stacksOfVote[] = $newStack;
}
$comments = [];
$res_comments = $bdd->query( 'SELECT * FROM fd_comment' );
while ( $d = $res_comments->fetch( \PDO::FETCH_OBJ ) ) {
$debug .= " <br> ajout de commentaire : ".$d->name. ' '. $d->comment;
$pollSlug = $d->poll_id;
$poll = $pollsBySlug[ $pollSlug ];
$newComment = new Comment();
$poll->addComment($newComment);
$newComment->setPoll($poll)
->setCreatedAt( date_create($d->date))
->setText( $d->comment)
// TODO update entities
->setPseudo( $d->name);
$em->persist( $newComment );
$comments[] = $newComment;
}
// gather objects
// create new polls
$em->flush();
// success
// failure notice
$debug .= " <br> <br> ça c'est fait. ";
return $this->render('pages/migration.html.twig' , [
"message" => "welcome to the framadate migration endpoint, it has yet to be done",
"debug" => $debug,
"OLD_DATABASE_NAME" => $this->getParameter( 'OLD_DATABASE_NAME' ),
"OLD_DATABASE_USER" => $this->getParameter( 'OLD_DATABASE_USER' ),
"counters" =>[
'polls' => count($pollsBySlug),
'comments' => count($comments),
'choices' => count($choicesCreated),
'stacks_of_votes' => count($stacksOfVote),
'votes' => count($votes),
]
]);
}
/**
* @param $numberToConvert
* conversion of answer:
* space character : no answer, 0 : no , 1 : maybe , 2 : yes
* @return string
*/
public function mapAnswerNumberToWord($numberToConvert){
$word = '';
switch ($numberToConvert){
case 0:
$word = 'no';
break;
case 1:
$word = 'maybe';
break;
case 2:
$word = 'yes';
break;
default:
$word = 'no';
}
return $word;
}
}

View File

@ -21,8 +21,15 @@ class PollController extends AbstractController
*/
public function index(PollRepository $pollRepository): Response
{
$polls = $pollRepository->findAll();
$titles=[];
foreach ( $polls as $poll ) {
$titles[] = $poll->getTitle();
}
return $this->render('poll/index.html.twig', [
'polls' => count($pollRepository->findAll()),
'count' => count($polls),
'polls' => $titles,
]);
}

View File

@ -6,6 +6,7 @@ use App\Controller\FramadateController;
use App\Entity\Choice;
use App\Entity\Owner;
use App\Entity\Poll;
use App\Repository\PollRepository;
use JMS\Serializer\Exception\RuntimeException;
use JMS\Serializer\SerializerBuilder;
use JMS\Serializer\SerializerInterface;
@ -33,15 +34,32 @@ class PollController extends FramadateController {
* name = "get_all_polls"
* )
*/
public function getAllPollsAction() {
$repository = $this->getDoctrine()->getRepository( Poll::class );
$data = $repository->findAll();
public function getAllPollsAction(PollRepository $pollRepository): Response {
$data = $pollRepository->findAll();
return $this->json( [
$polls = $data;
$titles=[];
$pollData = [
'message' => 'here are your polls',
'poll' => count( $data ),
] );
'count' => count($polls),
];
$debug=1;
if($debug){
foreach ( $polls as $poll ) {
$titles[] = ['title' => $poll->getTitle(),
'slug' => $poll->getCustomUrl()
];
}
$pollData['polls'] = $titles;
}
return $this->json( $pollData);
}
/**
@ -49,7 +67,7 @@ class PollController extends FramadateController {
* message when the poll is not found
* @return JsonResponse
*/
public function notFoundPoll($id){
public function notFoundPoll($id): Response{
return $this->json( [
'message' => $id . ' : poll not found',
],
@ -72,7 +90,7 @@ class PollController extends FramadateController {
SerializerInterface $serializer,
$id,
Request $request
) {
): Response {
$repository = $this->getDoctrine()->getRepository( Poll::class );
$poll = $repository->findOneByCustomUrl( $id );

0
src/Entity/.gitignore vendored Executable file → Normal file
View File

View File

@ -25,6 +25,13 @@ class Comment {
*/
private $owner;
/**
* @ORM\Column(type="string")
* @Serializer\Type("string")
* @Serializer\Expose()
*/
private $pseudo;
/**
* @ORM\Column(type="text")
* @Serializer\Type("string")
@ -98,6 +105,18 @@ class Comment {
public function setPoll( ?Poll $poll ): self {
$this->poll = $poll;
return $this;
}
public function getPseudo(): ?string
{
return $this->pseudo;
}
public function setPseudo(string $pseudo): self
{
$this->pseudo = $pseudo;
return $this;
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\Entity;
namespace App\Entity;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
@ -8,11 +8,11 @@
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
/**
* @ORM\Entity(repositoryClass="App\Repository\PollRepository")
* @Serializer\ExclusionPolicy("all")
*/
class Poll {
class Poll {
/**
* @ORM\Id()
* @ORM\GeneratedValue()
@ -58,7 +58,7 @@
*/
public $owner;
/**
* kind of poll, text or date
* kind of poll, 'text' or 'date'
* @ORM\Column(type="string", length=255)
* @Serializer\Type("string")
* @Serializer\Expose()
@ -72,6 +72,41 @@
* @Serializer\Expose()
*/
public $allowedAnswers;
/**
* people can add votes
* @ORM\Column(type="boolean", nullable=true)
* @Serializer\Type("boolean")
* @Serializer\Expose()
*/
public $votesAllowed;
/**
* max number of stack of votes possible.
* limits the number of people who can answer. as long as you trust the people to give only one answer with a reliable system.
* @ORM\Column(type="smallint", nullable=true)
* @Serializer\Type("smallint")
* @Serializer\Expose()
*/
public $votesMax;
/**
* max number of choices people can answer in a stack of vote. for text polls only, not date kind.
* by default, people can check as many answers as they want.
* If the question is "check your 3 favourite flavours" and displays 10 flavours, only the first 3 clicked will be taken into account. GUI should be able to make this clear and togglable so that people can change their 3 favourite flavours in their answer.
* @ORM\Column(type="smallint", nullable=true)
* @Serializer\Type("smallint")
* @Serializer\Expose()
*/
public $choicesMax;
/**
* people can add comments
* @ORM\Column(type="boolean", nullable=true)
* @Serializer\Type("boolean")
* @Serializer\Expose()
*/
public $commentsAllowed;
/**
* kind of way the people can modify the poll
* everybody - can modify votes
@ -535,7 +570,7 @@
return $this->choices;
}
public function addTextChoiceArray( Array $choiceTextArray ): self {
public function addTextChoiceArray( array $choiceTextArray ): self {
foreach ( $choiceTextArray as $text ) {
$newChoice = new Choice();
$newChoice->setName( $text );
@ -603,4 +638,44 @@
return $this;
}
public function getVotesAllowed(): ?bool {
return $this->votesAllowed;
}
public function setVotesAllowed( ?bool $votesAllowed ): self {
$this->votesAllowed = $votesAllowed;
return $this;
}
public function getVotesMax() {
return $this->votesMax;
}
public function setVotesMax( $votesMax ): self {
$this->votesMax = $votesMax;
return $this;
}
public function getChoicesMax() {
return $this->choicesMax;
}
public function setChoicesMax( $choicesMax ): self {
$this->choicesMax = $choicesMax;
return $this;
}
public function getCommentsAllowed(): ?bool {
return $this->commentsAllowed;
}
public function setCommentsAllowed( ?bool $commentsAllowed ): self {
$this->commentsAllowed = $commentsAllowed;
return $this;
}
}

53
src/Kernel.php Executable file → Normal file
View File

@ -3,51 +3,36 @@
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
protected function configureContainer(ContainerConfigurator $container): void
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
$container->import('../config/services.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
(require $path)($container->withPath($path), $this);
}
}
public function getProjectDir(): string
protected function configureRoutes(RoutingConfigurator $routes): void
{
return \dirname(__DIR__);
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
$routes->import('../config/{routes}/*.yaml');
if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
$routes->import('../config/routes.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
(require $path)($routes->withPath($path), $this);
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir().'/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
}

0
src/Repository/.gitignore vendored Executable file → Normal file
View File

View File

@ -4,7 +4,8 @@ namespace App\Repository;
use App\Entity\Poll;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Persistence\ManagerRegistry;
use MongoDB\Driver\Manager;
/**
* @method Poll|null find($id, $lockMode = null, $lockVersion = null)
@ -14,7 +15,8 @@ use Doctrine\Common\Persistence\ManagerRegistry;
*/
class PollRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
public function __construct(ManagerRegistry
$registry)
{
parent::__construct($registry, Poll::class);
}

394
symfony.lock Executable file → Normal file
View File

@ -8,96 +8,85 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672"
"ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
},
"files": [
"config/routes/annotations.yaml"
]
},
"doctrine/cache": {
"version": "v1.8.0"
"version": "1.10.2"
},
"doctrine/collections": {
"version": "v1.6.2"
"version": "1.6.7"
},
"doctrine/common": {
"version": "v2.11.0"
},
"doctrine/data-fixtures": {
"version": "v1.3.2"
"version": "3.1.2"
},
"doctrine/dbal": {
"version": "v2.9.2"
"version": "2.13.0"
},
"doctrine/deprecations": {
"version": "v0.5.3"
},
"doctrine/doctrine-bundle": {
"version": "1.6",
"version": "2.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.6",
"ref": "05802762c395b1e9f0f2645ebbd6128a87942f09"
"version": "2.3",
"ref": "9777bf185961283a450b6237281132935025fe04"
},
"files": [
"config/packages/doctrine.yaml",
"config/packages/prod/doctrine.yaml",
"config/packages/test/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-fixtures-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.0",
"ref": "fc52d86631a6dfd9fdf3381d0b7e3df2069e51b3"
},
"files": [
"src/DataFixtures/AppFixtures.php"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "1.2",
"version": "3.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.2",
"ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1"
"version": "3.1",
"ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
},
"files": [
"config/packages/doctrine_migrations.yaml",
"src/Migrations/.gitignore"
"migrations/.gitignore"
]
},
"doctrine/event-manager": {
"version": "v1.0.0"
},
"doctrine/inflector": {
"version": "v1.3.0"
},
"doctrine/instantiator": {
"version": "1.2.0"
},
"doctrine/lexer": {
"version": "1.1.0"
},
"doctrine/migrations": {
"version": "2.1.1"
},
"doctrine/orm": {
"version": "v2.6.4"
},
"doctrine/persistence": {
"version": "1.1.1"
},
"doctrine/reflection": {
"version": "v1.0.0"
"doctrine/inflector": {
"version": "2.0.3"
},
"doctrine/instantiator": {
"version": "1.4.0"
},
"doctrine/lexer": {
"version": "1.2.1"
},
"doctrine/migrations": {
"version": "3.1.1"
},
"doctrine/orm": {
"version": "2.8.4"
},
"doctrine/persistence": {
"version": "2.1.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"egulias/email-validator": {
"version": "2.1.15"
"version": "3.1.1"
},
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.3"
},
"friendsofsymfony/rest-bundle": {
"version": "2.2",
@ -112,10 +101,10 @@
]
},
"jms/metadata": {
"version": "2.1.0"
"version": "2.5.0"
},
"jms/serializer": {
"version": "3.3.0"
"version": "3.12.2"
},
"jms/serializer-bundle": {
"version": "3.0",
@ -132,85 +121,31 @@
]
},
"laminas/laminas-code": {
"version": "3.4.1"
"version": "4.1.0"
},
"laminas/laminas-eventmanager": {
"version": "3.3.0"
"version": "3.3.1"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.1.1"
},
"liip/test-fixtures-bundle": {
"version": "1.8.0"
},
"nelmio/api-doc-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "3.0",
"ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94"
},
"files": [
"config/packages/nelmio_api_doc.yaml",
"config/routes/nelmio_api_doc.yaml"
]
},
"nelmio/cors-bundle": {
"version": "1.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.5",
"ref": "6388de23860284db9acce0a7a5d9d13153bcb571"
},
"files": [
"config/packages/nelmio_cors.yaml"
]
"version": "1.2.0"
},
"nikic/php-parser": {
"version": "v4.2.4"
"version": "v4.10.4"
},
"ocramius/package-versions": {
"version": "1.4.0"
},
"ocramius/proxy-manager": {
"version": "2.2.3"
},
"overblog/graphql-bundle": {
"version": "0.12",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "0.12",
"ref": "c01dcfb85a6e93f1a43ef36151fcff11cf17f791"
},
"files": [
"config/graphql/types/.gitignore",
"config/packages/graphql.yaml",
"config/routes/graphql.yaml"
]
},
"php": {
"version": "7.4"
},
"phpdocumentor/reflection-common": {
"version": "2.0.0"
},
"phpdocumentor/reflection-docblock": {
"version": "4.3.2"
},
"phpdocumentor/type-resolver": {
"version": "1.0.1"
"phpstan/phpdoc-parser": {
"version": "0.4.14"
},
"psr/cache": {
"version": "1.0.1"
"version": "2.0.0"
},
"psr/container": {
"version": "1.1.1"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.1.0"
"version": "1.1.3"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
@ -225,68 +160,58 @@
]
},
"swiftmailer/swiftmailer": {
"version": "v6.2.3"
"version": "v6.2.7"
},
"symfony/asset": {
"version": "v4.3.11"
},
"symfony/browser-kit": {
"version": "v4.3.11"
"version": "v5.2.4"
},
"symfony/cache": {
"version": "v4.3.5"
"version": "v5.2.6"
},
"symfony/cache-contracts": {
"version": "v1.1.7"
"version": "2.4-dev"
},
"symfony/config": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/console": {
"version": "3.3",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "482d233eb8de91ebd042992077bbd5838858890c"
"version": "5.1",
"ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
},
"files": [
"bin/console",
"config/bootstrap.php"
"bin/console"
]
},
"symfony/debug": {
"version": "v4.3.5"
},
"symfony/dependency-injection": {
"version": "v4.3.5"
"version": "v5.2.6"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
"version": "v4.3.5"
},
"symfony/dom-crawler": {
"version": "v4.3.11"
"version": "v5.2.6"
},
"symfony/dotenv": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/error-handler": {
"version": "v5.2.6"
},
"symfony/event-dispatcher": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/event-dispatcher-contracts": {
"version": "v1.1.7"
},
"symfony/expression-language": {
"version": "v4.3.11"
"version": "v2.2.0"
},
"symfony/filesystem": {
"version": "v4.3.5"
"version": "v5.2.6"
},
"symfony/finder": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/flex": {
"version": "1.0",
@ -294,57 +219,46 @@
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "19fa03bacd9a6619583d1e4939da4388df22984d"
"ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
},
"files": [
".env"
]
},
"symfony/form": {
"version": "v4.3.5"
"version": "v5.2.6"
},
"symfony/framework-bundle": {
"version": "4.2",
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "61ad963f28c091b8bb9449507654b9c7d8bbb53c"
"version": "5.2",
"ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
},
"files": [
"config/bootstrap.php",
"config/packages/cache.yaml",
"config/packages/framework.yaml",
"config/packages/test/framework.yaml",
"config/preload.php",
"config/routes/dev/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
"src/Kernel.php"
]
},
"symfony/http-client-contracts": {
"version": "v2.3.1"
},
"symfony/http-foundation": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/http-kernel": {
"version": "v4.3.5"
},
"symfony/inflector": {
"version": "v4.3.5"
"version": "v5.2.6"
},
"symfony/intl": {
"version": "v4.3.5"
},
"symfony/mailer": {
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.3",
"ref": "15658c2a0176cda2e7dba66276a2030b52bd81b2"
},
"files": [
"config/packages/mailer.yaml"
]
"version": "v5.2.4"
},
"symfony/maker-bundle": {
"version": "1.0",
@ -355,64 +269,49 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/mime": {
"version": "v4.3.5"
},
"symfony/options-resolver": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/orm-pack": {
"version": "v1.0.7"
"version": "v2.1.0"
},
"symfony/phpunit-bridge": {
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.3",
"ref": "6d0e35f749d5f4bfe1f011762875275cd3f9874f"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
"symfony/polyfill-intl-grapheme": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-icu": {
"version": "v1.12.0"
"version": "v1.22.1"
},
"symfony/polyfill-intl-idn": {
"version": "v1.12.0"
"version": "v1.22.1"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.20.0"
"version": "v1.22.1"
},
"symfony/polyfill-mbstring": {
"version": "v1.12.0"
},
"symfony/polyfill-php72": {
"version": "v1.12.0"
"version": "v1.22.1"
},
"symfony/polyfill-php73": {
"version": "v1.12.0"
"version": "v1.22.1"
},
"symfony/process": {
"version": "v4.3.6"
"symfony/polyfill-php80": {
"version": "v1.22.1"
},
"symfony/property-access": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/property-info": {
"version": "v4.3.6"
"version": "v5.2.4"
},
"symfony/proxy-manager-bridge": {
"version": "v5.2.4"
},
"symfony/routing": {
"version": "4.2",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "683dcb08707ba8d41b7e34adb0344bfd68d248a7"
"version": "5.1",
"ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
},
"files": [
"config/packages/prod/routing.yaml",
@ -421,16 +320,16 @@
]
},
"symfony/security-core": {
"version": "v4.3.5"
},
"symfony/security-csrf": {
"version": "v4.3.11"
"version": "v5.2.6"
},
"symfony/service-contracts": {
"version": "v1.1.7"
"version": "v2.2.0"
},
"symfony/stopwatch": {
"version": "v4.3.5"
"version": "v5.2.4"
},
"symfony/string": {
"version": "v5.2.6"
},
"symfony/swiftmailer-bundle": {
"version": "2.5",
@ -447,98 +346,41 @@
]
},
"symfony/translation-contracts": {
"version": "v1.1.7"
"version": "v2.3.0"
},
"symfony/twig-bridge": {
"version": "v4.3.10"
"version": "v5.2.6"
},
"symfony/twig-bundle": {
"version": "3.3",
"version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "1da1987340b5ba64b16383906d678b989e3d096e"
"version": "5.0",
"ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d"
},
"files": [
"config/packages/test/twig.yaml",
"config/packages/twig.yaml",
"config/routes/dev/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/validator": {
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.3",
"ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
},
"files": [
"config/packages/test/validator.yaml",
"config/packages/validator.yaml"
]
"symfony/var-dumper": {
"version": "v5.2.6"
},
"symfony/var-exporter": {
"version": "v4.3.5"
},
"symfony/web-server-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a"
}
},
"symfony/webpack-encore-bundle": {
"version": "1.6",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.6",
"ref": "69e1d805ad95964088bd510c05995e87dc391564"
},
"files": [
"assets/app.js",
"assets/styles/app.css",
"config/packages/assets.yaml",
"config/packages/prod/webpack_encore.yaml",
"config/packages/test/webpack_encore.yaml",
"config/packages/webpack_encore.yaml",
"package.json",
"webpack.config.js"
]
"version": "v5.2.4"
},
"symfony/yaml": {
"version": "v4.3.5"
"version": "v5.2.5"
},
"twig/twig": {
"version": "v2.12.3"
},
"webimpress/safe-writer": {
"version": "2.1.0"
},
"webmozart/assert": {
"version": "1.5.0"
},
"webonyx/graphql-php": {
"version": "v0.13.9"
"version": "v3.3.0"
},
"willdurand/jsonp-callback-validator": {
"version": "v1.1.0"
},
"willdurand/negotiation": {
"version": "v2.3.1"
},
"zendframework/zend-code": {
"version": "3.4.0"
},
"zendframework/zend-eventmanager": {
"version": "3.2.1"
},
"zircote/swagger-php": {
"version": "2.0.14"
"version": "3.0.0"
}
}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello AdminController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/html/sf5/labase/src/Controller/AdminController.php'|file_link(0) }}">src/Controller/AdminController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/html/sf5/labase/templates/admin/index.html.twig'|file_link(0) }}">templates/admin/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello DefaultController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/html/sf5/labase/src/Controller/DefaultController.php'|file_link(0) }}">src/Controller/DefaultController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/html/sf5/labase/templates/default/index.html.twig'|file_link(0) }}">templates/default/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello MigrationController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/html/sf5/labase/src/Controller/MigrationController.php'|file_link(0) }}">src/Controller/MigrationController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/html/sf5/labase/templates/migration/index.html.twig'|file_link(0) }}">templates/migration/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello OwnerController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/html/sf5/labase/src/Controller/OwnerController.php'|file_link(0) }}">src/Controller/OwnerController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/html/sf5/labase/templates/owner/index.html.twig'|file_link(0) }}">templates/owner/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% extends 'base.html.twig' %}
{% block outerBody %}
<h1>Bienvenue à la maison!</h1>
<section class="home">
<app-root></app-root>
<script src="runtime.js" crossorigin="anonymous" defer></script>
<script src="es5-polyfills.js" crossorigin="anonymous" nomodule defer></script>
<script src="other-polyfills.js" crossorigin="anonymous" defer></script>
<script src="scripts.js" crossorigin="anonymous" defer></script>
<script src="main.js" crossorigin="anonymous" defer></script>
</section>
{% endblock %}

View File

@ -0,0 +1,82 @@
{% extends 'base.html.twig' %}
{% block title %}migration depuis un Framadate version 1{% endblock %}
{% block body %}
<main>
<h1>🍰 Migration des sondages depuis un Framadate version 1 </h1>
<fieldset>
Depuis la base de données <strong>
{{ OLD_DATABASE_NAME }}
</strong>
avec l'utilisateur <strong>
{{ OLD_DATABASE_USER }}
</strong> vers la base symfony locale, telle que configurée dans le fichier <strong> .env </strong>.
</fieldset>
<fieldset>
🎉 Ont été migrés:
<ul>
<li>
🎈 Sondages: {{ counters.polls }}
</li>
<li>
🍾 stacks of vote: {{ counters.polls }}
</li>
<li>
🧁 slots : {{ counters.choices }}
</li>
<li>
🍰 votes : {{ counters.votes }}
</li>
<li>
☕ comments : {{ counters.comments }}
</li>
</ul>
</fieldset>
<section class="well">
<hr>
Debug:
<br>
{{ debug | nl2br}}
</section>
</main>
<style type="text/css">
main {
margin: 0 auto;
width: 90vw;
}
fieldset{
margin-bottom: 1em;
}
.well{
font-size: 0.85rem;
background: #dedede;
padding: 1em;
}
html, body, main, header, footer, div {
font-family: Ubuntu, Arial, sans-serif;
}
.email {
padding: 1em;
}
.footer-content {
margin-top: 1em;
background: #f2dff2;
}
ul {
border-left: 3px solid #f2dff2;
}
h1, h2, h3 {
color: #3c334a;
}
</style>
{% endblock %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello VoteController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/var/www/html/sf5/labase/src/Controller/VoteController.php'|file_link(0) }}">src/Controller/VoteController.php</a></code></li>
<li>Your template at <code><a href="{{ '/var/www/html/sf5/labase/templates/vote/index.html.twig'|file_link(0) }}">templates/vote/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -1,74 +0,0 @@
var Encore = require('@symfony/webpack-encore');
// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// only needed for CDN's or sub-directory deploy
//.setManifestKeyPrefix('build/')
/*
* ENTRY CONFIG
*
* Add 1 entry for each "page" of your app
* (including one that's included on every page - e.g. "app")
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './assets/app.js')
//.addEntry('page1', './assets/page1.js')
//.addEntry('page2', './assets/page2.js')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// enables @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = 3;
})
// enables Sass/SCSS support
.enableSassLoader()
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
.enableIntegrityHashes(Encore.isProduction())
// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
// uncomment if you use API Platform Admin (composer req api-admin)
//.enableReactPreset()
//.addEntry('admin', './assets/admin.js')
;
module.exports = Encore.getWebpackConfig();