Compare commits

..

2 Commits

Author SHA1 Message Date
Tchama 72fd1cf02d fix docker container config 2021-04-16 09:24:07 +02:00
Tchama f8cfbebd26 add Symfony installer in php container 2021-04-16 08:37:21 +02:00
63 changed files with 16 additions and 16280 deletions

6
.gitignore vendored
View File

@ -1,8 +1,6 @@
# Comment to include Symfony project
# app
app/*
!app/.keep
# Ignore Database datas
data
# IDE
.idea

View File

@ -56,21 +56,6 @@ Le dépôt utilise plusieurs branches qui peuvent être utilisée selon le point
* Control migrations: `bin/console doctrine:migrations:status`
* ...
## Yarn
* installation de webpack-encore: `composer require symfony/webpack-encore-bundle`
* pour finir il faut installer et lancer yarn:
* un script bash `docker-node.sh` lancera nodejs dans un conteneur quand on a besoin de yarn:
* au premier lancement du container node:14, j'initialise la mise en place:
* `npm install yarn`
* `npm install --force`
* puis je lance (ce qu'il faudra faire à chaque fois):
* `yarn encore dev` avec éventuellement l'option `--watch`
## Sass
* dans le container node, installation de sass: `npm install sass-loader@^11.0.0 sass --save-dev`
---
@ -98,4 +83,5 @@ Le dépôt utilise plusieurs branches qui peuvent être utilisée selon le point
* To clear volumes: `docker volume rm $(docker volume ls -q)`
* To clear networks: `docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')`
Disclaimer: This project has been generated on phpdocker.io

18
app/.gitignore vendored
View File

@ -1,18 +0,0 @@
/.env
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###

View File

@ -1,15 +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.css';
// SCSS
import './styles/app.scss';
// start the Stimulus application
import './bootstrap';

View File

@ -1,8 +0,0 @@
import { startStimulusApp } from '@symfony/stimulus-bridge';
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.(j|t)sx?$/
));

View File

@ -1,4 +0,0 @@
{
"controllers": [],
"entrypoints": []
}

View File

@ -1,16 +0,0 @@
import { Controller } from 'stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View File

@ -1,3 +0,0 @@
body {
background-color: lightgray;
}

View File

@ -1,4 +0,0 @@
h1 {
font-size: 400%;
}

View File

@ -1,43 +0,0 @@
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
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) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);

View File

@ -1,79 +0,0 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "1.11.99.1",
"doctrine/doctrine-bundle": "^2.2",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.8",
"sensio/framework-extra-bundle": "^6.1",
"symfony/console": "5.2.*",
"symfony/dotenv": "5.2.*",
"symfony/flex": "^1.3.1",
"symfony/form": "5.2.*",
"symfony/framework-bundle": "5.2.*",
"symfony/maker-bundle": "^1.29",
"symfony/proxy-manager-bridge": "5.2.*",
"symfony/security-csrf": "5.2.*",
"symfony/twig-bundle": "^5.2",
"symfony/validator": "5.2.*",
"symfony/webpack-encore-bundle": "^1.11",
"symfony/yaml": "5.2.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.2.*"
}
},
"require-dev": {
"symfony/debug-bundle": "5.2.*",
"symfony/stopwatch": "^5.2",
"symfony/var-dumper": "5.2.*",
"symfony/web-profiler-bundle": "^5.2"
}
}

6192
app/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::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\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
];

View File

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

View File

@ -1,19 +0,0 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

View File

@ -1,4 +0,0 @@
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View File

@ -1,6 +0,0 @@
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }

View File

@ -1,18 +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: '13'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

View File

@ -1,5 +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'

View File

@ -1,17 +0,0 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
#http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true
#fragments: true
php_errors:
log: true

View File

@ -1,20 +0,0 @@
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: pool
pool: doctrine.system_cache_pool
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,3 +0,0 @@
framework:
router:
strict_requirements: null

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

View File

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

View File

@ -1,3 +0,0 @@
sensio_framework_extra:
router:
annotations: false

View File

@ -1,4 +0,0 @@
framework:
test: true
session:
storage_id: session.storage.mock_file

View File

@ -1,2 +0,0 @@
twig:
strict_variables: true

View File

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

View File

@ -1,6 +0,0 @@
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }

View File

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

View File

@ -1,3 +0,0 @@
twig:
default_path: '%kernel.project_dir%/templates'
form_themes: ['bootstrap_4_layout.html.twig']

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,30 +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
# Set attributes that will be rendered on all script and link tags
script_attributes:
defer: true
# link_attributes:
# 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:
# 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

View File

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

View File

@ -1,3 +0,0 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index

View File

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

View File

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

View File

@ -1,7 +0,0 @@
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@ -1,31 +0,0 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# 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:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# 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/'
- '../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/'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

View File

@ -1,34 +0,0 @@
<?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 Version20210218191150 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
$this->addSql('CREATE SEQUENCE beer_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE beer (id INT NOT NULL, name VARCHAR(255) NOT NULL, alcool DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id))');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE beer_id_seq CASCADE');
$this->addSql('DROP TABLE beer');
}
}

8650
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
{
"devDependencies": {
"@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.0.0",
"core-js": "^3.0.0",
"regenerator-runtime": "^0.13.2",
"sass": "^1.32.7",
"sass-loader": "^11.0.1",
"stimulus": "^2.0.0",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
},
"dependencies": {
"yarn": "^1.22.10"
}
}

View File

@ -1,22 +0,0 @@
<?php
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

View File

View File

@ -1,94 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Beer;
use App\Form\BeerType;
use App\Repository\BeerRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/beer")
*/
class BeerController extends AbstractController
{
/**
* @Route("/", name="beer_index", methods={"GET"})
*/
public function index(BeerRepository $beerRepository): Response
{
return $this->render('beer/index.html.twig', [
'beers' => $beerRepository->findAll(),
]);
}
/**
* @Route("/new", name="beer_new", methods={"GET","POST"})
*/
public function new(Request $request): Response
{
$beer = new Beer();
$form = $this->createForm(BeerType::class, $beer);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($beer);
$entityManager->flush();
return $this->redirectToRoute('beer_index');
}
return $this->render('beer/new.html.twig', [
'beer' => $beer,
'form' => $form->createView(),
]);
}
/**
* @Route("/{id}", name="beer_show", methods={"GET"})
*/
public function show(Beer $beer): Response
{
return $this->render('beer/show.html.twig', [
'beer' => $beer,
]);
}
/**
* @Route("/{id}/edit", name="beer_edit", methods={"GET","POST"})
*/
public function edit(Request $request, Beer $beer): Response
{
$form = $this->createForm(BeerType::class, $beer);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('beer_index');
}
return $this->render('beer/edit.html.twig', [
'beer' => $beer,
'form' => $form->createView(),
]);
}
/**
* @Route("/{id}", name="beer_delete", methods={"DELETE"})
*/
public function delete(Request $request, Beer $beer): Response
{
if ($this->isCsrfTokenValid('delete'.$beer->getId(), $request->request->get('_token'))) {
$entityManager = $this->getDoctrine()->getManager();
$entityManager->remove($beer);
$entityManager->flush();
}
return $this->redirectToRoute('beer_index');
}
}

View File

View File

@ -1,58 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\BeerRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=BeerRepository::class)
*/
class Beer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $alcool;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getAlcool(): ?float
{
return $this->alcool;
}
public function setAlcool(?float $alcool): self
{
$this->alcool = $alcool;
return $this;
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace App\Form;
use App\Entity\Beer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class BeerType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('alcool')
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Beer::class,
]);
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
protected function configureContainer(ContainerConfigurator $container): void
{
$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);
}
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$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);
}
}
}

View File

View File

@ -1,50 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Beer;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Beer|null find($id, $lockMode = null, $lockVersion = null)
* @method Beer|null findOneBy(array $criteria, array $orderBy = null)
* @method Beer[] findAll()
* @method Beer[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class BeerRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Beer::class);
}
// /**
// * @return Beer[] Returns an array of Beer objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->orderBy('b.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Beer
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -1,391 +0,0 @@
{
"composer/package-versions-deprecated": {
"version": "1.11.99.1"
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
},
"files": [
"config/routes/annotations.yaml"
]
},
"doctrine/cache": {
"version": "1.10.2"
},
"doctrine/collections": {
"version": "1.6.7"
},
"doctrine/common": {
"version": "3.1.1"
},
"doctrine/dbal": {
"version": "2.12.1"
},
"doctrine/doctrine-bundle": {
"version": "2.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.0",
"ref": "40631978d2c4adc9b11220b13eba539b727c36a8"
},
"files": [
"config/packages/doctrine.yaml",
"config/packages/prod/doctrine.yaml",
"src/Entity/.gitignore",
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "2.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.2",
"ref": "baaa439e3e3179e69e3da84b671f0a3e4a2f56ad"
},
"files": [
"config/packages/doctrine_migrations.yaml",
"migrations/.gitignore"
]
},
"doctrine/event-manager": {
"version": "1.1.1"
},
"doctrine/inflector": {
"version": "2.0.3"
},
"doctrine/instantiator": {
"version": "1.4.0"
},
"doctrine/lexer": {
"version": "1.2.1"
},
"doctrine/migrations": {
"version": "3.1.0"
},
"doctrine/orm": {
"version": "2.8.2"
},
"doctrine/persistence": {
"version": "2.1.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.3"
},
"laminas/laminas-code": {
"version": "3.4.1"
},
"laminas/laminas-eventmanager": {
"version": "3.3.0"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.1.1"
},
"nikic/php-parser": {
"version": "v4.10.4"
},
"psr/cache": {
"version": "1.0.1"
},
"psr/container": {
"version": "1.0.0"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.1.3"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"config/packages/sensio_framework_extra.yaml"
]
},
"symfony/asset": {
"version": "v5.2.3"
},
"symfony/cache": {
"version": "v5.2.3"
},
"symfony/cache-contracts": {
"version": "v2.2.0"
},
"symfony/config": {
"version": "v5.2.3"
},
"symfony/console": {
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.1",
"ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
},
"files": [
"bin/console"
]
},
"symfony/debug-bundle": {
"version": "4.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.1",
"ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea"
},
"files": [
"config/packages/dev/debug.yaml"
]
},
"symfony/dependency-injection": {
"version": "v5.2.3"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
"version": "v5.2.3"
},
"symfony/dotenv": {
"version": "v5.2.3"
},
"symfony/error-handler": {
"version": "v5.2.3"
},
"symfony/event-dispatcher": {
"version": "v5.2.3"
},
"symfony/event-dispatcher-contracts": {
"version": "v2.2.0"
},
"symfony/filesystem": {
"version": "v5.2.3"
},
"symfony/finder": {
"version": "v5.2.3"
},
"symfony/flex": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
},
"files": [
".env"
]
},
"symfony/form": {
"version": "v5.2.3"
},
"symfony/framework-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
},
"files": [
"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": "v5.2.3"
},
"symfony/http-kernel": {
"version": "v5.2.3"
},
"symfony/intl": {
"version": "v5.2.3"
},
"symfony/maker-bundle": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/options-resolver": {
"version": "v5.2.3"
},
"symfony/orm-pack": {
"version": "v2.1.0"
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-icu": {
"version": "v1.22.1"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.22.1"
},
"symfony/polyfill-mbstring": {
"version": "v1.22.1"
},
"symfony/polyfill-php73": {
"version": "v1.22.1"
},
"symfony/polyfill-php80": {
"version": "v1.22.1"
},
"symfony/profiler-pack": {
"version": "v1.0.5"
},
"symfony/property-access": {
"version": "v5.2.3"
},
"symfony/property-info": {
"version": "v5.2.3"
},
"symfony/proxy-manager-bridge": {
"version": "v5.2.3"
},
"symfony/routing": {
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.1",
"ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
},
"files": [
"config/packages/prod/routing.yaml",
"config/packages/routing.yaml",
"config/routes.yaml"
]
},
"symfony/security-core": {
"version": "v5.2.3"
},
"symfony/security-csrf": {
"version": "v5.2.3"
},
"symfony/service-contracts": {
"version": "v2.2.0"
},
"symfony/stopwatch": {
"version": "v5.2.3"
},
"symfony/string": {
"version": "v5.2.3"
},
"symfony/translation-contracts": {
"version": "v2.3.0"
},
"symfony/twig-bridge": {
"version": "v5.2.3"
},
"symfony/twig-bundle": {
"version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.0",
"ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d"
},
"files": [
"config/packages/test/twig.yaml",
"config/packages/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/twig-pack": {
"version": "v1.0.1"
},
"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.3"
},
"symfony/var-exporter": {
"version": "v5.2.3"
},
"symfony/web-profiler-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6"
},
"files": [
"config/packages/dev/web_profiler.yaml",
"config/packages/test/web_profiler.yaml",
"config/routes/dev/web_profiler.yaml"
]
},
"symfony/webpack-encore-bundle": {
"version": "1.9",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.9",
"ref": "34a82422147bc632dec0db2676bf27aaaa582ba0"
},
"files": [
"assets/app.js",
"assets/bootstrap.js",
"assets/controllers.json",
"assets/controllers/hello_controller.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"
]
},
"symfony/yaml": {
"version": "v5.2.3"
},
"twig/extra-bundle": {
"version": "v3.3.0"
},
"twig/twig": {
"version": "v3.3.0"
}
}

View File

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
<!-- Bootstrap CDN -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- Fork Awesome icons CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css" integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY=" crossorigin="anonymous">
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
<!-- Bootstrap CDN (+ jQuery) -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>

View File

@ -1,5 +0,0 @@
<form method="post" action="{{ path('beer_delete', {'id': beer.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ beer.id) }}">
<button class="btn btn-{{ btn_color|default('danger')}}"><i class="fa fa-trash fa-fw"></i> {{'Delete'}}</button>
</form>

View File

@ -1,4 +0,0 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn btn-{{ btn_color|default('primary')}}">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -1,19 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}{{'Edit Beer'}}{% endblock %}
{% block body %}
<div class="container">
<h1 class="display-1">{{'Edit Beer'}}</h1>
{{ include('beer/_form.html.twig', {'button_label': 'Update', 'btn_color': 'warning'}) }}
<a href="{{ path('beer_index') }}" class="btn btn-secondary" role="button">
<i class="fa fa-arrow-left fa-fw"></i> {{'back to list'}}
</a>
{{ include('beer/_delete_form.html.twig') }}
</div>
{% endblock %}

View File

@ -1,47 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}{{'Beer index'}}{% endblock %}
{% block body %}
{# responsive, fixed-width container class #}
<div class="container">
<h1 class="display-1">{{'Beer index'}}</h1>
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">{{'Id'}}</th>
<th scope="col">{{'Name'}}</th>
<th scope="col">{{'Alcool'}}</th>
<th scope="col">{{'actions'}}</th>
</tr>
</thead>
<tbody>
{% for beer in beers %}
<tr>
<th scope="row">{{ beer.id }}</th>
<td>{{ beer.name }}</td>
<td>{{ beer.alcool }}</td>
<td>
<a href="{{ path('beer_show', {'id': beer.id}) }}" class="btn btn-secondary" role="button" title="{{'show'}}">
<i class="fa fa-eye fa-fw"></i>
</a>
<a href="{{ path('beer_edit', {'id': beer.id}) }}" class="btn btn-warning" role="button" title="{{'edit'}}">
<i class="fa fa-pencil fa-fw"></i>
</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">{{'no records found'}}</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('beer_new') }}" class="btn btn-primary" role="button">
<i class="fa fa-plus fa-fw"></i> {{'Create new'}}
</a>
</div>
{% endblock %}

View File

@ -1,17 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}{{'New Beer'}}{% endblock %}
{% block body %}
<div class="container">
<h1 class="display-1">{{'Create new Beer'}}</h1>
{{ include('beer/_form.html.twig') }}
<a href="{{ path('beer_index') }}" class="btn btn-secondary" role="button">
<i class="fa fa-arrow-left fa-fw"></i> {{'back to list'}}
</a>
</div>
{% endblock %}

View File

@ -1,37 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}{{'Beer'}}{% endblock %}
{% block body %}
<div class="container">
<h1 class="display-1">{{'Beer'}}</h1>
<table class="table">
<tbody>
<tr>
<th scope="row">{{'Id'}}</th>
<td>{{ beer.id }}</td>
</tr>
<tr>
<th scope="row">{{'Name'}}</th>
<td>{{ beer.name }}</td>
</tr>
<tr>
<th scope="row">{{'Alcool'}}</th>
<td>{{ beer.alcool }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('beer_index') }}" class="btn btn-secondary" role="button">
<i class="fa fa-arrow-left fa-fw"></i> {{'back to list'}}
</a>
<a href="{{ path('beer_edit', {'id': beer.id}) }}" class="btn btn-warning" role="button">
<i class="fa fa-pencil fa-fw"></i> {{'edit'}}
</a>
{{ include('beer/_delete_form.html.twig') }}
</div>
{% endblock %}

View File

@ -1,75 +0,0 @@
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 sub-directory 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')
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
// 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())
.configureBabel((config) => {
config.plugins.push('@babel/plugin-proposal-class-properties');
})
// 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 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();

View File

@ -1,22 +0,0 @@
#!/bin/bash
# Ce script permet de lancer node dans un conteneur docker séparé,
# afin de disposer des outils comme yarn (paquet npm)
# exécute toujours dans le répertoire `php`
cd $(dirname $0)
# la commande exécutée dans le conteneur
if [ $# -eq 0 ]; then
cmd=bash
else
cmd="${@}"
fi
# le conteneur node monte le dossier de l'application
docker run --rm -it \
--user "$(id -u):$(id -g)" \
--volume "${PWD}/app:/app" \
--workdir "/app" \
--env "YARN_CACHE_FOLDER=/app/.yarncache" \
node:14 ${cmd}

View File

@ -53,9 +53,22 @@ RUN { \
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Symfony installer
RUN curl -sS https://get.symfony.com/cli/installer -o /usr/local/bin/installer | bash \
&& chmod a+x /usr/local/bin/installer \
&& /usr/local/bin/installer \
&& mv /root/.symfony/bin/symfony /usr/local/bin/symfony \
&& chmod a+x /usr/local/bin/symfony
# Add users/groups with uid 1000
RUN groupadd --gid ${GID} "group${GID}" \
&& useradd --uid ${UID} --gid ${GID} --create-home "user${UID}"
USER ${UID}
RUN git config --global user.email "docker-php-master@champs-libres.coop" \
&& git config --global user.name "Docker PHP Master"
USER root
WORKDIR "/var/www/app"