[dsfr] Squelette pour tests

This commit is contained in:
2023-11-05 10:12:59 +01:00
parent 74505da148
commit 76889148a1
36 changed files with 5395 additions and 1939 deletions

21
.env
View File

@@ -18,24 +18,3 @@
APP_ENV=dev
APP_SECRET=c34e19f7ba8d19f7dee0aabf27b35e72
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###
###> symfony/mailer ###
# MAILER_DSN=null://null
###< symfony/mailer ###

7
.gitignore vendored
View File

@@ -18,3 +18,10 @@
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

14
assets/app.js Normal file
View File

@@ -0,0 +1,14 @@
/*
* 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';
require('@gouvfr/dsfr/src/main.js')
require('./js/main');

2
assets/styles/app.scss Normal file
View File

@@ -0,0 +1,2 @@
@import "@gouvfr/dsfr/dist/dsfr.css";

Submodule bundles/dsfr-form-theme-bundle added at 20e26e9334

View File

@@ -1,14 +0,0 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
mailer:
image: schickling/mailcatcher
ports: ["1025", "1080"]
###< symfony/mailer ###

View File

@@ -1,21 +1,29 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-15}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
php:
build: docker/php-fpm
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
- .:/var/www
- ./docker/php-fpm/php.ini:/usr/local/etc/php/conf.d/php.override.ini:ro
volumes:
###> doctrine/doctrine-bundle ###
database_data:
###< doctrine/doctrine-bundle ###
nginx:
build: docker/nginx
depends_on:
- php
volumes:
- .:/var/www
- ../data/logs/nginx/:/var/log/nginx
- ./docker/nginx/dev/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/dev/sites/:/etc/nginx/sites-available
- ./docker/nginx/dev/conf.d/:/etc/nginx/conf.d
- ./docker/nginx/dev/snippets/:/etc/nginx/snippets
ports:
- "8081:80"
- "8444:443"
node:
build: docker/node
tty: true
volumes:
- .:/var/www

View File

@@ -7,14 +7,10 @@
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.16",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.24",
"symfony/asset": "6.3.*",
"symfony/console": "6.3.*",
"symfony/doctrine-messenger": "6.3.*",
"symfony/dotenv": "6.3.*",
"symfony/expression-language": "6.3.*",
"symfony/flex": "^2",
@@ -22,7 +18,6 @@
"symfony/framework-bundle": "6.3.*",
"symfony/http-client": "6.3.*",
"symfony/intl": "6.3.*",
"symfony/mailer": "6.3.*",
"symfony/mime": "6.3.*",
"symfony/monolog-bundle": "^3.0",
"symfony/notifier": "6.3.*",
@@ -37,6 +32,7 @@
"symfony/twig-bundle": "6.3.*",
"symfony/validator": "6.3.*",
"symfony/web-link": "6.3.*",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "6.3.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
@@ -51,7 +47,8 @@
},
"autoload": {
"psr-4": {
"App\\": "src/"
"App\\": "src/",
"RadicalDingos\\DsfrFormThemeBundle\\": "bundles/dsfr-form-theme-bundle/"
}
},
"autoload-dev": {

2043
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,8 +2,6 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
@@ -11,4 +9,6 @@ return [
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
RadicalDingos\DsfrFormThemeBundle\RadicalDingosDsfrFormThemeBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

View File

@@ -1,49 +0,0 @@
doctrine:
dbal:
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: '15'
profiling_collect_backtrace: '%kernel.debug%'
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
type: attribute
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View File

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

View File

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

View File

@@ -1,24 +0,0 @@
framework:
messenger:
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
use_notify: true
check_delayed_interval: 60000
retry_strategy:
max_retries: 3
multiplier: 2
failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
Symfony\Component\Notifier\Message\ChatMessage: async
Symfony\Component\Notifier\Message\SmsMessage: async
# Route your messages to the transports
# 'App\Message\YourMessage': async

View File

@@ -1,5 +1,6 @@
twig:
default_path: '%kernel.project_dir%/templates'
form_themes: ['@RadicalDingosDsfrFormTheme/Form/dsfr_form_theme.html.twig']
when@test:
twig:

View File

@@ -0,0 +1,45 @@
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
# Set attributes that will be rendered on all script and link tags
script_attributes:
defer: true
# Uncomment (also under link_attributes) if using Turbo Drive
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
# 'data-turbo-track': reload
# link_attributes:
# Uncomment if using Turbo Drive
# 'data-turbo-track': reload
# 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 HTTP/2 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:
# frontend: '%kernel.project_dir%/public/frontend/build'
# pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
#when@prod:
# webpack_encore:
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# # Available in version 1.2
# cache: true
#when@test:
# webpack_encore:
# strict_mode: false

18
docker/nginx/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM debian:bookworm-slim
MAINTAINER Jérôme Fix <jerome.fix@zapoyok.info>
RUN apt-get update && apt-get upgrade --no-install-recommends --no-install-suggests -y && apt-get install --no-install-recommends --no-install-suggests -y \
nginx \
ca-certificates \
gettext-base
# SSL
ADD "ssl/scc-crm.localhost+1-key.pem" "/etc/ssl/private/scc-crm.localhost+1-key.pem"
ADD "ssl/scc-crm.localhost+1.pem" "/etc/ssl/certs/scc-crm.localhost+1.pem"
RUN usermod -u 1000 www-data
EXPOSE 80 443
CMD ["nginx"]

View File

@@ -0,0 +1,3 @@
upstream php-upstream {
server php:9000;
}

View File

@@ -0,0 +1,45 @@
user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http {
server_tokens off;
sendfile off;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
open_file_cache max=100;
client_max_body_size 500M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
rewrite_log on;
}

View File

@@ -0,0 +1,67 @@
server {
listen 80;
server_name localhost;
root /var/www/public;
include /etc/nginx/snippets/expires.conf;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
error_log /var/log/nginx/crm_error.log;
access_log /var/log/nginx/crm_access.log;
}
server {
listen 443 ssl;
ssl_certificate /etc/ssl/certs/scc-crm.localhost+1.pem;
ssl_certificate_key /etc/ssl/private/scc-crm.localhost+1-key.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
ssl_prefer_server_ciphers on;
server_name localhost;
root /var/www/public;
include /etc/nginx/snippets/expires.conf;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
error_page 497 https://$host:$server_port/error.html;
error_log /var/log/nginx/crm_error.log;
access_log /var/log/nginx/crm_access.log;
}

View File

@@ -0,0 +1,55 @@
# Expire rules for static content
# No default expire rule. This config mirrors that of apache as outlined in the
# html5-boilerplate .htaccess file. However, nginx applies rules by location,
# the apache rules are defined by type. A consequence of this difference is that
# if you use no file extension in the url and serve html, with apache you get an
# expire time of 0s, with nginx you'd get an expire header of one month in the
# future (if the default expire rule is 1 month). Therefore, do not use a
# default expire rule with nginx unless your site is completely static
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|json)$ {
expires -1;
access_log /var/log/nginx/static.log;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~ '^/css/compiled' {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
location ~ '^/js/compiled' {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# Cross domain webfont access
location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
add_header "Access-Control-Allow-Origin" "*";
# Also, set cache rules for webfonts.
#
# See http://wiki.nginx.org/HttpCoreModule#location
# And https://github.com/h5bp/server-configs/issues/85
# And https://github.com/h5bp/server-configs/issues/86
expires 1M;
access_log off;
add_header Cache-Control "public";
}

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDS2F+031v2GnVk
IiH/FL59vd/zLnol7wBpNHkOy0glDCtV4r7oNKOlBh3xziOu0C/ScwgKvB4uSn0G
mMEw9aBw1nWP95pchWkyIHEectAxtl8ISfJWbhu5qvGfgf837LWd6KBpcVfrDmj+
fLiUGS4gC/8UzrPP+qJy8/BQ5wgM1qiClCWXfs7c3NG4KpO/xge/RgjcXzUG5brN
7elL/SpOX2RDmIa4YJzJPIp3oLMlTZxMmMMYBxbCFVdjKu2QJiVlhniZOJZt3lsA
0lYbBvkK/5S0i8SKp2CznbbSaEYbbrzJ8yqCg2LU2yLBWyJjhmtiC/rveRSvtE5I
MeRWg+p9AgMBAAECggEBAI/XOYPFlZFR/6AugQ7qcgKKlMvsezyBzr/3Ildra26K
3M2dASydLL8aazdZsJJESTvDaksYh2aBPsZPVA04pRoV1OJAwzg3c8rUwxdIsKwZ
hL+84uz/9T43VtvA7gKTJFv0JeuJfbdIf2yOXcX7X7JRPNZPJfDPRiAyN1KaKq3G
TpUBchIvoVxr9D79FUD5Es+NCrsPBsq97x6tZzZR1pZptBDNvc9XRerBTf7MwIbn
8g7O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bUr5mrxoDCYAonZ9e0j7JSjaalvr3I40K
JdiZNSySoIbVPf9itP3YxJNqfIx23YFs4JlQGTvZzOYFfXKMuDjaGyqy3+OCBir5
pxLSqTXC9FGoRC6T+S/WwCODq4bcJz0cKgvYp0f+xaZ5/POMbXC+hpJ1ojcwF+D4
f5vRQlzfnGSFgsc8FHff5/1dS5ZaAFDRLYQ4K1M7FNafAtitnG/vx5xAz7VSTi3G
TxWhGrSmbJX0GmLDQIfOQyUYipW3RHvhw+JpPZ7ShR4G/Iacaslcjb8qDwgPNm7g
UnBMo9DEXEYK4XUaF7ZYLKUCqu41ECS+4EB+vASiMuYBIRDEGU5Uj1NG4eq4tCx9
6+M3w76jVd3c+MAqAed69Sqyx5Sx0Zzz/bKnU6T2WA==
-----END CERTIFICATE-----

3
docker/node/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM node:lts-buster
WORKDIR /var/www

33
docker/php-fpm/Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM php:8.2-fpm-alpine
### Install XDEBUG extension.
RUN apk add --update linux-headers
RUN apk add --no-cache $PHPIZE_DEPS \
&& pecl install -f xdebug \
&& docker-php-ext-enable xdebug \
&& apk del $PHPIZE_DEPS
### Install INTL extension.
RUN apk add --no-cache icu-dev icu-data-full && \
docker-php-ext-install intl
RUN docker-php-ext-install sysvsem
### Install composer / composer-normalize.
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
ADD https://github.com/ergebnis/composer-normalize/releases/download/2.28.3/composer-normalize.phar /usr/local/bin/composer-normalize
RUN chmod 755 /usr/local/bin/composer-normalize
### Install tools
RUN apk add --no-cache \
yamllint \
libxml2-utils \
make \
git
WORKDIR /var/www
CMD ["php-fpm"]
EXPOSE 9000

19
docker/php-fpm/php.ini Normal file
View File

@@ -0,0 +1,19 @@
[PHP]
date.timezone=Europe/Paris
;log_errors=On
;error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
;display_errors=Off
max_execution_time=30
memory_limit=-1
upload_max_filesize = 100M
post_max_size = 100M
[opcache]
; http://symfony.com/doc/current/performance.html
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
realpath_cache_size=4096K
realpath_cache_ttl=600
xdebug.mode=develop,coverage

25
package.json Normal file
View File

@@ -0,0 +1,25 @@
{
"devDependencies": {
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.0",
"@symfony/webpack-encore": "^4.0.0",
"core-js": "^3.23.0",
"regenerator-runtime": "^0.13.9",
"sass": "^1.69.5",
"sass-loader": "^13.0.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-notifier": "^1.15.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"dependencies": {
"@gouvfr/dsfr": "^1.10.2"
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\SubmitButton;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Validator\Constraints as Asserts;
#[Route(path: '/dsfr', name: 'app_dsfr_index')]
class DSFRController extends AbstractController
{
public function __invoke(Request $request): Response
{
$choices = [
'Choice #1' => 1,
'Choice #2' => 2,
'Choice #3' => 3,
'Choice #4' => 4,
'Choice #1' => 5,
'Choice #6' => 6,
];
$form = $this->createFormBuilder([])
->add('choice_single_expanded', ChoiceType::class, [
'choices' =>$choices ,
'multiple' => false,
'expanded' => true,
'help' => 'Lorem Ipsum',
'required' => true,
'constraints' => [new Asserts\NotNull()]
])
->add('choice_multiple_expanded', ChoiceType::class, [
'choices' =>$choices ,
'multiple' => true,
'expanded' => true,
'help' => 'Lorem Ipsum',
'constraints' => [new Asserts\NotNull()]
])
->add('choice_single_compact', ChoiceType::class, [
'choices' =>$choices ,
'multiple' => false,
'expanded' => false,
'help' => 'Lorem Ipsum',
'constraints' => [new Asserts\Count(['min' => 1])]
])
->add('choice_multiple_compact', ChoiceType::class, [
'choices' =>$choices ,
'multiple' => true,
'expanded' => false,
'help' => 'Lorem Ipsum',
'constraints' => [new Asserts\NotNull()]
])
->add('simpleString', TextType::class, [
'help' => 'Lorem Ipsum',
'constraints' => [new Asserts\NotBlank()],
])
->add('textarea', TextareaType::class, [
'constraints' => [new Asserts\NotBlank()],
'help' => 'Lorem Ipsum'
])
->add('btnSubmit', SubmitType::class, [
])
->getForm() ;
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
}
return $this->render('dsfr/index.html.twig', [
'form' => $form->createView(),
]);
}
}

View File

View File

View File

@@ -1,31 +1,4 @@
{
"doctrine/doctrine-bundle": {
"version": "2.10",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.10",
"ref": "0db4b12b5df45f5122213b4ecd18733ab7fa7d53"
},
"files": [
"config/packages/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "3.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.1",
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
},
"files": [
"config/packages/doctrine_migrations.yaml",
"migrations/.gitignore"
]
},
"phpunit/phpunit": {
"version": "9.6",
"recipe": {
@@ -95,18 +68,6 @@
"src/Kernel.php"
]
},
"symfony/mailer": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "4.3",
"ref": "2bf89438209656b85b9a49238c4467bff1b1f939"
},
"files": [
"config/packages/mailer.yaml"
]
},
"symfony/maker-bundle": {
"version": "1.51",
"recipe": {
@@ -116,18 +77,6 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/messenger": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.0",
"ref": "ba1ac4e919baba5644d31b57a3284d6ba12d52ee"
},
"files": [
"config/packages/messenger.yaml"
]
},
"symfony/monolog-bundle": {
"version": "3.8",
"recipe": {
@@ -255,6 +204,22 @@
"config/packages/messenger.yaml"
]
},
"symfony/webpack-encore-bundle": {
"version": "2.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.0",
"ref": "082d754b3bd54b3fc669f278f1eea955cfd23cf5"
},
"files": [
"assets/app.js",
"assets/styles/app.css",
"config/packages/webpack_encore.yaml",
"package.json",
"webpack.config.js"
]
},
"twig/extra-bundle": {
"version": "v3.7.1"
}

View File

@@ -5,9 +5,11 @@
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{% endblock %}
</head>
<body>

View File

@@ -0,0 +1,19 @@
{% extends 'base.html.twig' %}
{% block title %}Hello DSFRController!{% 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">
{# {% form_theme form ['@RadicalDingosDsfrFormTheme/Form/dsfr_form_theme.html.twig'] only %}#}
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
{{ form_widget(form) }}
{{ form_end(form) }}
</div>
{% endblock %}

73
webpack.config.js Normal file
View File

@@ -0,0 +1,73 @@
const 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 subdirectory deploy
//.setManifestKeyPrefix('build/')
/*
* ENTRY CONFIG
*
* 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')
// 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())
// configure Babel
// .configureBabel((config) => {
// config.plugins.push('@babel/a-babel-plugin');
// })
// enables and configure @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
// enables Sass/SCSS support
.enableSassLoader()
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment if you use React
//.enableReactPreset()
// 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()
;
module.exports = Encore.getWebpackConfig();

4477
yarn.lock Normal file

File diff suppressed because it is too large Load Diff