├── .editorconfig ├── .env ├── .env.local.docker ├── .env.test ├── .eslintrc.json ├── .gitignore ├── .gitlab-ci.yml ├── .gitlab-pages.html ├── .php_cs ├── .phpcs.xml ├── .phpmd.xml ├── .sensiolabs.yml ├── Makefile ├── README.md ├── assets ├── css │ └── app.css └── js │ └── app.js ├── bin ├── console └── phpunit ├── composer.json ├── composer.lock ├── config ├── bootstrap.php ├── bundles.php ├── packages │ ├── assets.yaml │ ├── cache.yaml │ ├── dev │ │ ├── debug.yaml │ │ ├── routing.yaml │ │ └── web_profiler.yaml │ ├── doctrine.yaml │ ├── doctrine_migrations.yaml │ ├── framework.yaml │ ├── prod │ │ ├── doctrine.yaml │ │ └── webpack_encore.yaml │ ├── routing.yaml │ ├── security_checker.yaml │ ├── sensio_framework_extra.yaml │ ├── test │ │ ├── framework.yaml │ │ ├── routing.yaml │ │ ├── validator.yaml │ │ └── web_profiler.yaml │ ├── twig.yaml │ ├── validator.yaml │ └── webpack_encore.yaml ├── routes.yaml ├── routes │ ├── annotations.yaml │ └── dev │ │ ├── twig.yaml │ │ └── web_profiler.yaml └── services.yaml ├── docker-compose.gitlab-ci.yml ├── docker-compose.override.yml.dist ├── docker-compose.yml ├── docker ├── h2-proxy │ ├── Dockerfile │ └── conf.d │ │ └── default.conf ├── nginx │ └── vhost.conf ├── node │ ├── Dockerfile │ └── entrypoint.sh └── php │ ├── Dockerfile │ └── entrypoint.sh ├── package.json ├── phpunit.xml.dist ├── public ├── favicon.ico ├── index.php └── robots.txt ├── src ├── Controller │ └── PizzaController.php ├── DataFixtures │ ├── AppFixtures.php │ └── PizzaFixtures.php ├── Entity │ └── Pizza.php ├── Form │ └── PizzaType.php ├── Kernel.php ├── Migrations │ ├── Version20171208151336.php │ └── Version20180402204848.php └── Repository │ └── PizzaRepository.php ├── symfony.lock ├── templates ├── base.html.twig ├── homepage.html.twig └── pizza │ ├── _delete_form.html.twig │ ├── _form.html.twig │ ├── edit.html.twig │ ├── index.html.twig │ ├── new.html.twig │ └── show.html.twig ├── tests └── .gitignore ├── webpack.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | insert_final_newline = true 9 | indent_style = space 10 | indent_size = 4 11 | trim_trailing_whitespace = true 12 | 13 | [Makefile] 14 | indent_style = tab 15 | trim_trailing_whitespace = false 16 | 17 | [assets/**] 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # This file is a "template" of which env vars need to be defined for your application 2 | # Copy this file to .env file for development, create environment variables when deploying to production 3 | # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration 4 | 5 | ###> symfony/framework-bundle ### 6 | APP_ENV=dev 7 | APP_SECRET=eb7ac76ae3a8d523e374902b88f622dc 8 | # 127.0.0.1,127.0.0.2 9 | # localhost,example.com 10 | ###< symfony/framework-bundle ### 11 | 12 | ###> doctrine/doctrine-bundle ### 13 | # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url 14 | # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" 15 | # Configure your db driver and server_version in config/packages/doctrine.yaml 16 | DATABASE_URL=mysql://root:@database:3306/db_name 17 | ###< doctrine/doctrine-bundle ### 18 | -------------------------------------------------------------------------------- /.env.local.docker: -------------------------------------------------------------------------------- 1 | DATABASE_URL=mysql://root:@database:3306/db_name 2 | -------------------------------------------------------------------------------- /.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS='App\Kernel' 3 | APP_SECRET='$ecretf0rt3st' 4 | SYMFONY_DEPRECATIONS_HELPER=999999 5 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "browser": true 5 | }, 6 | "rules": { 7 | "quotes": [2, "single"], 8 | "no-console": "warn" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###> symfony/framework-bundle ### 2 | /.env.local 3 | /.env.local.php 4 | /.env.*.local 5 | /public/bundles/ 6 | /var/ 7 | /vendor/ 8 | ###< symfony/framework-bundle ### 9 | ###> symfony/phpunit-bridge ### 10 | .phpunit 11 | /phpunit.xml 12 | ###< symfony/phpunit-bridge ### 13 | 14 | ###> symfony/webpack-encore-bundle ### 15 | /node_modules/ 16 | /public/build/ 17 | npm-debug.log 18 | yarn-error.log 19 | ###< symfony/webpack-encore-bundle ### 20 | 21 | docker-compose.override.yml 22 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - docker 3 | - tests 4 | - quality-assurance 5 | - deploy 6 | 7 | image: mykiwi/docker 8 | services: 9 | - docker:dind 10 | variables: 11 | DOCKER_DRIVER: overlay2 12 | COMPOSE_FILE: "docker-compose.yml:docker-compose.gitlab-ci.yml" 13 | 14 | .template-load-gitlab-image: &internal-image 15 | before_script: 16 | - cp -f .env.dist .env 17 | - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com 18 | - docker-compose pull php node || true 19 | 20 | .template-docker: &external-image 21 | before_script: 22 | - cp -f .env.dist .env 23 | 24 | build-docker-images: 25 | <<: *internal-image 26 | stage: docker 27 | script: 28 | - docker-compose build --pull 29 | - docker-compose push 30 | only: 31 | - master 32 | 33 | tests: 34 | <<: *internal-image 35 | stage: tests 36 | coverage: '/^\s*Lines:\s*\d+.\d+\%/' 37 | script: 38 | - make start 39 | - make test 40 | artifacts: 41 | paths: 42 | - var/artefacts/coverage/ 43 | expire_in: 1 week 44 | 45 | check-security: 46 | <<: *internal-image 47 | stage: quality-assurance 48 | script: 49 | - make start 50 | - make security 51 | 52 | check-yaml-files: 53 | <<: *internal-image 54 | stage: quality-assurance 55 | script: 56 | - make start 57 | - make ly 58 | 59 | check-twig-files: 60 | <<: *internal-image 61 | stage: quality-assurance 62 | script: 63 | - make start 64 | - make lt 65 | 66 | phpmd: 67 | <<: *external-image 68 | stage: quality-assurance 69 | script: 70 | - make phpmd || true # Bug with php 7.1 71 | 72 | php_codesnifer: 73 | <<: *external-image 74 | stage: quality-assurance 75 | script: 76 | - make php_codesnifer 77 | 78 | php-cs-fixer: 79 | <<: *external-image 80 | stage: quality-assurance 81 | script: 82 | - make php-cs-fixer 83 | 84 | eslint: 85 | <<: *internal-image 86 | stage: quality-assurance 87 | script: 88 | - make start 89 | - make eslint 90 | 91 | phpcpd: 92 | <<: *external-image 93 | stage: quality-assurance 94 | script: 95 | - make phpcpd 96 | 97 | phploc: 98 | <<: *external-image 99 | stage: quality-assurance 100 | script: 101 | - make phploc 102 | 103 | pdepend: 104 | <<: *external-image 105 | stage: quality-assurance 106 | script: 107 | - make pdepend 108 | artifacts: 109 | paths: 110 | - var/artefacts/pdepend_summary.xml 111 | - var/artefacts/pdepend_jdepend.svg 112 | - var/artefacts/pdepend_pyramid.svg 113 | expire_in: 1 week 114 | 115 | phpmetrics: 116 | <<: *external-image 117 | stage: quality-assurance 118 | script: 119 | - make phpmetrics 120 | artifacts: 121 | paths: 122 | - var/artefacts/phpmetrics 123 | expire_in: 1 week 124 | 125 | ci-report: 126 | stage: deploy 127 | only: 128 | - master 129 | script: 130 | - rm -rf public/* 131 | - cp .gitlab-pages.html var/artefacts/index.html 132 | - sed -i "s/PLACEHOLDER_GIT_COMMIT/${CI_COMMIT_SHA}/g" var/artefacts/index.html 133 | - cp -R var/artefacts/* public/ 134 | artifacts: 135 | paths: 136 | - public 137 | -------------------------------------------------------------------------------- /.gitlab-pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 14 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | 9 | 10 | For the full copyright and license information, please view the LICENSE 11 | file that was distributed with this source code. 12 | OEF; 13 | 14 | return PhpCsFixer\Config::create() 15 | ->setRiskyAllowed(true) 16 | ->setRules([ 17 | '@Symfony' => true, 18 | '@Symfony:risky' => true, 19 | 'header_comment' => ['header' => $header], 20 | 'array_syntax' => ['syntax' => 'short'], 21 | 'ordered_class_elements' => true, 22 | 'ordered_imports' => true, 23 | 'heredoc_to_nowdoc' => true, 24 | 'php_unit_strict' => true, 25 | 'php_unit_construct' => true, 26 | 'phpdoc_add_missing_param_annotation' => true, 27 | 'phpdoc_order' => true, 28 | 'strict_comparison' => true, 29 | 'strict_param' => true, 30 | 'no_extra_consecutive_blank_lines' => [ 31 | 'break', 32 | 'continue', 33 | 'extra', 34 | 'return', 35 | 'throw', 36 | 'use', 37 | 'parenthesis_brace_block', 38 | 'square_brace_block', 39 | 'curly_brace_block', 40 | ], 41 | 'no_short_echo_tag' => true, 42 | 'no_unreachable_default_argument_value' => true, 43 | 'no_useless_else' => true, 44 | 'no_useless_return' => true, 45 | 'semicolon_after_instruction' => true, 46 | 'combine_consecutive_unsets' => true, 47 | 'ternary_to_null_coalescing' => true, 48 | ]) 49 | ->setFinder( 50 | PhpCsFixer\Finder::create() 51 | ->in('src') 52 | ) 53 | ; 54 | -------------------------------------------------------------------------------- /.phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 34 | 35 | 36 | 37 | 0 38 | 39 | 40 | 41 | 42 | 0 43 | 44 | 45 | 0 46 | 47 | 48 | 0 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /.phpmd.xml: -------------------------------------------------------------------------------- 1 | 7 | mess detection 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /.sensiolabs.yml: -------------------------------------------------------------------------------- 1 | commit_failure_conditions: 2 | - 'project.grade < platinum' 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_COMPOSE = docker-compose 2 | 3 | EXEC_PHP = $(DOCKER_COMPOSE) exec -T php /entrypoint 4 | EXEC_JS = $(DOCKER_COMPOSE) exec -T node /entrypoint 5 | 6 | SYMFONY = $(EXEC_PHP) bin/console 7 | COMPOSER = $(EXEC_PHP) composer 8 | YARN = $(EXEC_JS) yarn 9 | 10 | ## 11 | ## Project 12 | ## ------- 13 | ## 14 | 15 | build: 16 | @$(DOCKER_COMPOSE) pull --parallel --quiet --ignore-pull-failures 2> /dev/null 17 | $(DOCKER_COMPOSE) build --pull 18 | 19 | kill: 20 | $(DOCKER_COMPOSE) kill 21 | $(DOCKER_COMPOSE) down --volumes --remove-orphans 22 | 23 | install: ## Install and start the project 24 | install: .env.local build start assets db 25 | 26 | reset: ## Stop and start a fresh install of the project 27 | reset: kill install 28 | 29 | start: ## Start the project 30 | $(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate 31 | 32 | stop: ## Stop the project 33 | $(DOCKER_COMPOSE) stop 34 | 35 | clean: ## Stop the project and remove generated files 36 | clean: kill 37 | rm -rf .env.local vendor node_modules 38 | 39 | no-docker: 40 | $(eval DOCKER_COMPOSE := \#) 41 | $(eval EXEC_PHP := ) 42 | $(eval EXEC_JS := ) 43 | 44 | .PHONY: build kill install reset start stop clean no-docker 45 | 46 | ## 47 | ## Utils 48 | ## ----- 49 | ## 50 | 51 | db: ## Reset the database and load fixtures 52 | db: .env.local vendor 53 | @$(EXEC_PHP) php -r 'echo "Wait database...\n"; set_time_limit(30); require __DIR__."/config/bootstrap.php"; $$u = parse_url($$_ENV["DATABASE_URL"]); for(;;) { if(@fsockopen($$u["host"].":".($$u["port"] ?? 3306))) { break; }}' 54 | -$(SYMFONY) doctrine:database:drop --if-exists --force 55 | -$(SYMFONY) doctrine:database:create --if-not-exists 56 | $(SYMFONY) doctrine:migrations:migrate --no-interaction --allow-no-migration 57 | $(SYMFONY) doctrine:fixtures:load --no-interaction --purge-with-truncate 58 | 59 | migration: ## Generate a new doctrine migration 60 | migration: vendor 61 | $(SYMFONY) doctrine:migrations:diff 62 | 63 | db-validate-schema: ## Validate the doctrine ORM mapping 64 | db-validate-schema: .env.local vendor 65 | $(SYMFONY) doctrine:schema:validate 66 | 67 | assets: ## Run Webpack Encore to compile assets 68 | assets: node_modules 69 | $(YARN) run dev 70 | 71 | watch: ## Run Webpack Encore in watch mode 72 | watch: node_modules 73 | $(YARN) run watch 74 | 75 | .PHONY: db migration assets watch 76 | 77 | ## 78 | ## Tests 79 | ## ----- 80 | ## 81 | 82 | test: ## Run unit and functional tests 83 | test: tu tf 84 | 85 | tu: ## Run unit tests 86 | tu: vendor 87 | $(EXEC_PHP) bin/phpunit --exclude-group functional 88 | 89 | tf: ## Run functional tests 90 | tf: vendor 91 | $(EXEC_PHP) bin/phpunit --group functional 92 | 93 | .PHONY: test tu tf 94 | 95 | # rules based on files 96 | composer.lock: composer.json 97 | $(COMPOSER) update --lock --no-scripts --no-interaction 98 | 99 | vendor: composer.lock 100 | $(COMPOSER) install 101 | 102 | node_modules: yarn.lock 103 | $(YARN) install 104 | @touch -c node_modules 105 | 106 | yarn.lock: package.json 107 | $(YARN) upgrade 108 | 109 | .env.local: .env.local.docker 110 | @if [ -f .env ]; \ 111 | then\ 112 | echo '\033[1;41m/!\ The .env.local.docker file has changed. Please check your .env.local file (this message will not be displayed again).\033[0m';\ 113 | touch .env.local;\ 114 | exit 1;\ 115 | else\ 116 | echo cp .env.local.docker .env.local;\ 117 | cp .env.local.docker .env.local;\ 118 | fi 119 | 120 | ## 121 | ## Quality assurance 122 | ## ----------------- 123 | ## 124 | 125 | QA = docker run --rm -v `pwd`:/project mykiwi/phaudit:7.3 126 | ARTEFACTS = var/artefacts 127 | 128 | lint: ## Lints twig and yaml files 129 | lint: lt ly 130 | 131 | lt: vendor 132 | $(SYMFONY) lint:twig templates 133 | 134 | ly: vendor 135 | $(SYMFONY) lint:yaml config 136 | 137 | security: ## Check security of your dependencies (https://security.sensiolabs.org/) 138 | security: vendor 139 | $(EXEC_PHP) ./vendor/bin/security-checker security:check 140 | 141 | phploc: ## PHPLoc (https://github.com/sebastianbergmann/phploc) 142 | $(QA) phploc src/ 143 | 144 | pdepend: ## PHP_Depend (https://pdepend.org) 145 | pdepend: artefacts 146 | $(QA) pdepend \ 147 | --summary-xml=$(ARTEFACTS)/pdepend_summary.xml \ 148 | --jdepend-chart=$(ARTEFACTS)/pdepend_jdepend.svg \ 149 | --overview-pyramid=$(ARTEFACTS)/pdepend_pyramid.svg \ 150 | src/ 151 | 152 | phpmd: ## PHP Mess Detector (https://phpmd.org) 153 | $(QA) phpmd src text .phpmd.xml 154 | 155 | php_codesnifer: ## PHP_CodeSnifer (https://github.com/squizlabs/PHP_CodeSniffer) 156 | $(QA) phpcs -v --standard=.phpcs.xml src 157 | 158 | phpcpd: ## PHP Copy/Paste Detector (https://github.com/sebastianbergmann/phpcpd) 159 | $(QA) phpcpd src 160 | 161 | phpdcd: ## PHP Dead Code Detector (https://github.com/sebastianbergmann/phpdcd) 162 | $(QA) phpdcd src 163 | 164 | phpmetrics: ## PhpMetrics (http://www.phpmetrics.org) 165 | phpmetrics: artefacts 166 | $(QA) phpmetrics --report-html=$(ARTEFACTS)/phpmetrics src 167 | 168 | php-cs-fixer: ## php-cs-fixer (http://cs.sensiolabs.org) 169 | $(QA) php-cs-fixer fix --dry-run --using-cache=no --verbose --diff 170 | 171 | apply-php-cs-fixer: ## apply php-cs-fixer fixes 172 | $(QA) php-cs-fixer fix --using-cache=no --verbose --diff 173 | 174 | twigcs: ## twigcs (https://github.com/allocine/twigcs) 175 | $(QA) twigcs lint templates 176 | 177 | eslint: ## eslint (https://eslint.org/) 178 | eslint: node_modules 179 | $(EXEC_JS) node_modules/.bin/eslint --fix-dry-run assets/js/** 180 | 181 | artefacts: 182 | mkdir -p $(ARTEFACTS) 183 | 184 | .PHONY: lint lt ly phploc pdepend phpmd php_codesnifer phpcpd phpdcd phpmetrics php-cs-fixer apply-php-cs-fixer artefacts 185 | 186 | 187 | 188 | .DEFAULT_GOAL := help 189 | help: 190 | @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' 191 | .PHONY: help 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Symfony Bootstrapped 2 | 3 | [![CI](https://gitlab.com/mykiwi/symfony-bootstrapped/badges/master/pipeline.svg)](https://gitlab.com/mykiwi/symfony-bootstrapped/commits/master) 4 | [![coverage](https://gitlab.com/mykiwi/symfony-bootstrapped/badges/master/coverage.svg)](https://mykiwi.gitlab.io/symfony-bootstrapped/) 5 | [![SensioLabsInsight](https://insight.sensiolabs.com/projects/266cbb90-53a2-4709-8ede-5cc961491271/mini.png)](https://insight.sensiolabs.com/projects/266cbb90-53a2-4709-8ede-5cc961491271) 6 | 7 | ## Install 8 | 9 | make # self documented makefile 10 | make install # install and start the project 11 | -------------------------------------------------------------------------------- /assets/css/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: lightgray; 3 | } 4 | -------------------------------------------------------------------------------- /assets/js/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Welcome to your app's main JavaScript file! 3 | * 4 | * We recommend including the built version of this JavaScript file 5 | * (and its CSS file) in your base layout (base.html.twig). 6 | */ 7 | 8 | // any CSS you require will output into a single css file (app.css in this case) 9 | require('../css/app.css'); 10 | 11 | // Need jQuery? Install it with "yarn add jquery", then uncomment to require it. 12 | // const $ = require('jquery'); 13 | 14 | console.log('Hello Webpack Encore! Edit me in assets/js/app.js'); 15 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | load(__DIR__.'/../.env'); 23 | } 24 | 25 | $input = new ArgvInput(); 26 | $env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev'); 27 | $debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']); 28 | 29 | if ($debug) { 30 | umask(0000); 31 | 32 | if (class_exists(Debug::class)) { 33 | Debug::enable(); 34 | } 35 | } 36 | 37 | $kernel = new Kernel($env, $debug); 38 | $application = new Application($kernel); 39 | $application->run($input); 40 | -------------------------------------------------------------------------------- /bin/phpunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | =1.2) 9 | if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { 10 | foreach ($env as $k => $v) { 11 | $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); 12 | } 13 | } elseif (!class_exists(Dotenv::class)) { 14 | throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); 15 | } else { 16 | // load all the .env files 17 | (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); 18 | } 19 | 20 | $_SERVER += $_ENV; 21 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; 22 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; 23 | $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; 24 | -------------------------------------------------------------------------------- /config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 6 | Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], 7 | Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], 8 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 9 | Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], 10 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], 11 | Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], 12 | Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], 13 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 14 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], 15 | ]; 16 | -------------------------------------------------------------------------------- /config/packages/assets.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | assets: 3 | json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' 4 | -------------------------------------------------------------------------------- /config/packages/cache.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | cache: 3 | # Put the unique name of your app here: the prefix seed 4 | # is used to compute stable namespaces for cache keys. 5 | #prefix_seed: your_vendor_name/app_name 6 | 7 | # The app cache caches to the filesystem by default. 8 | # Other options include: 9 | 10 | # Redis 11 | #app: cache.adapter.redis 12 | #default_redis_provider: redis://localhost 13 | 14 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) 15 | #app: cache.adapter.apcu 16 | 17 | # Namespaced pools use the above "app" backend by default 18 | #pools: 19 | #my.dedicated.cache: null 20 | -------------------------------------------------------------------------------- /config/packages/dev/debug.yaml: -------------------------------------------------------------------------------- 1 | debug: 2 | # Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser. 3 | # See the "server:dump" command to start a new server. 4 | dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" 5 | -------------------------------------------------------------------------------- /config/packages/dev/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /config/packages/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: true 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { only_exceptions: false } 7 | -------------------------------------------------------------------------------- /config/packages/doctrine.yaml: -------------------------------------------------------------------------------- 1 | doctrine: 2 | dbal: 3 | # configure these for your database server 4 | driver: 'pdo_mysql' 5 | server_version: '5.7' 6 | charset: utf8mb4 7 | default_table_options: 8 | charset: utf8mb4 9 | collate: utf8mb4_unicode_ci 10 | 11 | url: '%env(resolve:DATABASE_URL)%' 12 | orm: 13 | auto_generate_proxy_classes: true 14 | naming_strategy: doctrine.orm.naming_strategy.underscore 15 | auto_mapping: true 16 | mappings: 17 | App: 18 | is_bundle: false 19 | type: annotation 20 | dir: '%kernel.project_dir%/src/Entity' 21 | prefix: 'App\Entity' 22 | alias: App 23 | -------------------------------------------------------------------------------- /config/packages/doctrine_migrations.yaml: -------------------------------------------------------------------------------- 1 | doctrine_migrations: 2 | dir_name: '%kernel.project_dir%/src/Migrations' 3 | # namespace is arbitrary but should be different from App\Migrations 4 | # as migrations classes should NOT be autoloaded 5 | namespace: DoctrineMigrations 6 | -------------------------------------------------------------------------------- /config/packages/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | secret: '%env(APP_SECRET)%' 3 | #csrf_protection: true 4 | #http_method_override: true 5 | 6 | # Enables session support. Note that the session will ONLY be started if you read or write from it. 7 | # Remove or comment this section to explicitly disable session support. 8 | session: 9 | handler_id: null 10 | cookie_secure: auto 11 | cookie_samesite: lax 12 | 13 | #esi: true 14 | #fragments: true 15 | php_errors: 16 | log: true 17 | -------------------------------------------------------------------------------- /config/packages/prod/doctrine.yaml: -------------------------------------------------------------------------------- 1 | doctrine: 2 | orm: 3 | auto_generate_proxy_classes: false 4 | metadata_cache_driver: 5 | type: service 6 | id: doctrine.system_cache_provider 7 | query_cache_driver: 8 | type: service 9 | id: doctrine.system_cache_provider 10 | result_cache_driver: 11 | type: service 12 | id: doctrine.result_cache_provider 13 | 14 | services: 15 | doctrine.result_cache_provider: 16 | class: Symfony\Component\Cache\DoctrineProvider 17 | public: false 18 | arguments: 19 | - '@doctrine.result_cache_pool' 20 | doctrine.system_cache_provider: 21 | class: Symfony\Component\Cache\DoctrineProvider 22 | public: false 23 | arguments: 24 | - '@doctrine.system_cache_pool' 25 | 26 | framework: 27 | cache: 28 | pools: 29 | doctrine.result_cache_pool: 30 | adapter: cache.app 31 | doctrine.system_cache_pool: 32 | adapter: cache.system 33 | -------------------------------------------------------------------------------- /config/packages/prod/webpack_encore.yaml: -------------------------------------------------------------------------------- 1 | #webpack_encore: 2 | # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes) 3 | # Available in version 1.2 4 | #cache: true 5 | -------------------------------------------------------------------------------- /config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: null 4 | utf8: true 5 | -------------------------------------------------------------------------------- /config/packages/security_checker.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | _defaults: 3 | autowire: true 4 | autoconfigure: true 5 | 6 | SensioLabs\Security\SecurityChecker: null 7 | 8 | SensioLabs\Security\Command\SecurityCheckerCommand: null 9 | -------------------------------------------------------------------------------- /config/packages/sensio_framework_extra.yaml: -------------------------------------------------------------------------------- 1 | sensio_framework_extra: 2 | router: 3 | annotations: false 4 | -------------------------------------------------------------------------------- /config/packages/test/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | test: true 3 | session: 4 | storage_id: session.storage.mock_file 5 | -------------------------------------------------------------------------------- /config/packages/test/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /config/packages/test/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | not_compromised_password: false 4 | -------------------------------------------------------------------------------- /config/packages/test/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler: 2 | toolbar: false 3 | intercept_redirects: false 4 | 5 | framework: 6 | profiler: { collect: false } 7 | -------------------------------------------------------------------------------- /config/packages/twig.yaml: -------------------------------------------------------------------------------- 1 | twig: 2 | default_path: '%kernel.project_dir%/templates' 3 | debug: '%kernel.debug%' 4 | strict_variables: '%kernel.debug%' 5 | -------------------------------------------------------------------------------- /config/packages/validator.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | validation: 3 | email_validation_mode: html5 4 | 5 | # Enables validator auto-mapping support. 6 | # For instance, basic validation constraints will be inferred from Doctrine's metadata. 7 | #auto_mapping: 8 | # App\Entity\: [] 9 | -------------------------------------------------------------------------------- /config/packages/webpack_encore.yaml: -------------------------------------------------------------------------------- 1 | webpack_encore: 2 | # The path where Encore is building the assets. 3 | # This should match Encore.setOutputPath() in webpack.config.js. 4 | output_path: '%kernel.project_dir%/public/build' 5 | # If multiple builds are defined (as shown below), you can disable the default build: 6 | # output_path: false 7 | 8 | # if using Encore.enableIntegrityHashes() specify the crossorigin attribute value (default: false, or use 'anonymous' or 'use-credentials') 9 | # crossorigin: 'anonymous' 10 | 11 | # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes). 12 | # To enable caching for the production environment, creating a webpack_encore.yaml in the config/packages/prod directory with this value set to true 13 | # Available in version 1.2 14 | #cache: false 15 | -------------------------------------------------------------------------------- /config/routes.yaml: -------------------------------------------------------------------------------- 1 | index: 2 | path: / 3 | controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction 4 | defaults: 5 | path: /pizza 6 | -------------------------------------------------------------------------------- /config/routes/annotations.yaml: -------------------------------------------------------------------------------- 1 | controllers: 2 | resource: ../../src/Controller/ 3 | type: annotation 4 | -------------------------------------------------------------------------------- /config/routes/dev/twig.yaml: -------------------------------------------------------------------------------- 1 | _errors: 2 | resource: '@TwigBundle/Resources/config/routing/errors.xml' 3 | prefix: /_error 4 | -------------------------------------------------------------------------------- /config/routes/dev/web_profiler.yaml: -------------------------------------------------------------------------------- 1 | web_profiler_wdt: 2 | resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' 3 | prefix: /_wdt 4 | 5 | web_profiler_profiler: 6 | resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' 7 | prefix: /_profiler 8 | -------------------------------------------------------------------------------- /config/services.yaml: -------------------------------------------------------------------------------- 1 | # This file is the entry point to configure your own services. 2 | # Files in the packages/ subdirectory configure your dependencies. 3 | 4 | # Put parameters here that don't need to change on each machine where the app is deployed 5 | # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration 6 | parameters: 7 | 8 | services: 9 | # default configuration for services in *this* file 10 | _defaults: 11 | autowire: true # Automatically injects dependencies in your services. 12 | autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. 13 | 14 | # makes classes in src/ available to be used as services 15 | # this creates a service per class whose id is the fully-qualified class name 16 | App\: 17 | resource: '../src/*' 18 | exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' 19 | 20 | # controllers are imported separately to make sure services can be injected 21 | # as action arguments even if you don't extend any base controller class 22 | App\Controller\: 23 | resource: '../src/Controller' 24 | tags: ['controller.service_arguments'] 25 | 26 | # add more service definitions when explicit configuration is needed 27 | # please note that last definitions always *replace* previous ones 28 | -------------------------------------------------------------------------------- /docker-compose.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | php: 5 | image: ${CI_REGISTRY}/${CI_PROJECT_PATH}:php 6 | build: 7 | cache_from: 8 | - ${CI_REGISTRY}/${CI_PROJECT_PATH}:php 9 | 10 | node: 11 | image: ${CI_REGISTRY}/${CI_PROJECT_PATH}:node 12 | build: 13 | cache_from: 14 | - ${CI_REGISTRY}/${CI_PROJECT_PATH}:node 15 | -------------------------------------------------------------------------------- /docker-compose.override.yml.dist: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | ## Reminder about ports 4 | ## target = container port 5 | ## published = localhost port 6 | 7 | 8 | services: 9 | database: 10 | ports: 11 | # - target: 3306 12 | # published: 3306 13 | 14 | http: 15 | ports: 16 | # - target: 80 17 | # published: 80 18 | 19 | https: 20 | ports: 21 | # - target: 8443 22 | # published: 443 23 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | database: 5 | image: mariadb:10 6 | environment: 7 | - MYSQL_ALLOW_EMPTY_PASSWORD=true 8 | volumes: 9 | - database:/var/lib/mysql 10 | 11 | http: 12 | image: nginx:1-alpine 13 | depends_on: 14 | - php 15 | volumes: 16 | - ./docker/nginx/vhost.conf:/etc/nginx/conf.d/default.conf:ro 17 | - ./public/:/srv/public/:ro 18 | 19 | https: 20 | build: 21 | context: ./docker/h2-proxy 22 | depends_on: 23 | - http 24 | 25 | php: 26 | build: 27 | context: ./docker/php 28 | working_dir: /srv 29 | volumes: 30 | - ./:/srv/ 31 | 32 | node: 33 | build: 34 | context: ./docker/node 35 | working_dir: /srv 36 | volumes: 37 | - ./:/srv/ 38 | 39 | volumes: 40 | database: ~ 41 | -------------------------------------------------------------------------------- /docker/h2-proxy/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_ALPINE_IMAGE=nginx:1-alpine 2 | 3 | FROM $BASE_ALPINE_IMAGE 4 | 5 | RUN set -xe \ 6 | && apk add --no-cache \ 7 | openssl \ 8 | && openssl genrsa \ 9 | -des3 \ 10 | -passout pass:NotSecure \ 11 | -out cert.pass.key \ 12 | 2048 \ 13 | && openssl rsa \ 14 | -passin pass:NotSecure \ 15 | -in cert.pass.key \ 16 | -out cert.key \ 17 | && openssl req \ 18 | -new \ 19 | -passout pass:NotSecure \ 20 | -key cert.key \ 21 | -out cert.csr \ 22 | -subj '/C=SS/ST=SS/L=The Internet/O=Symfony/CN=client' \ 23 | && openssl x509 \ 24 | -req \ 25 | -sha256 \ 26 | -days 365 \ 27 | -in cert.csr \ 28 | -signkey cert.key \ 29 | -out cert.crt 30 | 31 | FROM $BASE_ALPINE_IMAGE 32 | 33 | COPY --from=0 cert.key cert.crt /etc/nginx/ssl/ 34 | COPY conf.d /etc/nginx/conf.d/ 35 | -------------------------------------------------------------------------------- /docker/h2-proxy/conf.d/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 443 ssl http2; 3 | listen [::]:443 ssl http2; 4 | 5 | ssl_certificate /etc/nginx/ssl/cert.crt; 6 | ssl_certificate_key /etc/nginx/ssl/cert.key; 7 | 8 | location / { 9 | proxy_pass http://http; 10 | proxy_http_version 1.1; 11 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 12 | proxy_set_header X-Forwarded-Host $host; 13 | proxy_set_header X-Forwarded-Proto $scheme; 14 | proxy_set_header X-Forwarded-Port 443; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /docker/nginx/vhost.conf: -------------------------------------------------------------------------------- 1 | upstream phpfcgi { 2 | server php:9000; 3 | } 4 | 5 | server { 6 | listen 80; 7 | server_name localhost; 8 | root /srv/public; 9 | 10 | location / { 11 | try_files $uri @rewriteapp; 12 | } 13 | 14 | location @rewriteapp { 15 | rewrite ^(.*)$ /index.php/$1 last; 16 | } 17 | 18 | location ~ ^/index.php(/|$) { 19 | include fastcgi_params; 20 | fastcgi_pass php:9000; 21 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 22 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 23 | fastcgi_param HTTPS off; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /docker/node/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12-alpine 2 | 3 | RUN apk add --no-cache su-exec && \ 4 | addgroup bar && \ 5 | adduser -D -h /home -s /bin/sh -G bar foo 6 | 7 | ADD entrypoint.sh /entrypoint 8 | 9 | ENTRYPOINT ["/entrypoint"] 10 | -------------------------------------------------------------------------------- /docker/node/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | uid=$(stat -c %u /srv) 4 | gid=$(stat -c %g /srv) 5 | 6 | if [ $uid == 0 ] && [ $gid == 0 ]; then 7 | if [ $# -eq 0 ]; then 8 | sleep 9999d 9 | else 10 | exec "$@" 11 | fi 12 | fi 13 | 14 | sed -i -r "s/node:x:1000:1000:Linux/node:x:100:100:Linux/g" /etc/passwd 15 | 16 | sed -i -r "s/foo:x:\d+:\d+:/foo:x:$uid:$gid:/g" /etc/passwd 17 | sed -i -r "s/bar:x:\d+:/bar:x:$gid:/g" /etc/group 18 | chown foo /home 19 | 20 | if [ $# -eq 0 ]; then 21 | sleep 9999d 22 | else 23 | exec su-exec foo "$@" 24 | fi 25 | -------------------------------------------------------------------------------- /docker/php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM composer 2 | 3 | FROM php:7.3-fpm-alpine 4 | 5 | COPY --from=composer /usr/bin/composer /usr/local/bin/composer 6 | 7 | ENV APCU_VERSION 5.1.17 8 | 9 | RUN apk add --no-cache \ 10 | ca-certificates \ 11 | icu-libs \ 12 | git \ 13 | unzip \ 14 | libzip-dev \ 15 | zlib-dev && \ 16 | apk add --no-cache --virtual .build-deps \ 17 | $PHPIZE_DEPS \ 18 | icu-dev && \ 19 | docker-php-ext-install \ 20 | intl \ 21 | zip && \ 22 | pecl install apcu-${APCU_VERSION} && \ 23 | docker-php-ext-enable apcu && \ 24 | docker-php-ext-enable opcache && \ 25 | docker-php-ext-install pdo_mysql && \ 26 | echo "short_open_tag = off" >> /usr/local/etc/php/php.ini && \ 27 | echo "date.timezone = Europe/Paris" >> /usr/local/etc/php/conf.d/symfony.ini && \ 28 | echo "opcache.max_accelerated_files = 20000" >> /usr/local/etc/php/conf.d/symfony.ini && \ 29 | echo "realpath_cache_size=4096K" >> /usr/local/etc/php/conf.d/symfony.ini && \ 30 | echo "realpath_cache_ttl=600" >> /usr/local/etc/php/conf.d/symfony.ini && \ 31 | apk del .build-deps && \ 32 | apk add gosu --update --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted && \ 33 | addgroup bar && \ 34 | adduser -D -h /home -s /bin/sh -G bar foo 35 | 36 | ADD entrypoint.sh /entrypoint 37 | 38 | ENTRYPOINT ["/entrypoint"] 39 | -------------------------------------------------------------------------------- /docker/php/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | uid=$(stat -c %u /srv) 4 | gid=$(stat -c %g /srv) 5 | 6 | if [ $uid == 0 ] && [ $gid == 0 ]; then 7 | if [ $# -eq 0 ]; then 8 | php-fpm --allow-to-run-as-root 9 | else 10 | echo "$@" 11 | exec "$@" 12 | fi 13 | fi 14 | 15 | sed -i -r "s/foo:x:\d+:\d+:/foo:x:$uid:$gid:/g" /etc/passwd 16 | sed -i -r "s/bar:x:\d+:/bar:x:$gid:/g" /etc/group 17 | 18 | sed -i "s/user = www-data/user = foo/g" /usr/local/etc/php-fpm.d/www.conf 19 | sed -i "s/group = www-data/group = bar/g" /usr/local/etc/php-fpm.d/www.conf 20 | 21 | user=$(grep ":x:$uid:" /etc/passwd | cut -d: -f1) 22 | if [ $# -eq 0 ]; then 23 | php-fpm 24 | else 25 | echo gosu $user "$@" 26 | exec gosu $user "$@" 27 | fi 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@symfony/webpack-encore": "^0.27", 4 | "eslint": "^6.0" 5 | }, 6 | "license": "UNLICENSED", 7 | "private": true, 8 | "scripts": { 9 | "dev-server": "encore dev-server", 10 | "dev": "encore dev", 11 | "watch": "encore dev --watch", 12 | "build": "encore production" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | tests/ 37 | 38 | 39 | 40 | 41 | 42 | ./src/ 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mykiwi/symfony-bootstrapped/9d4d50b0a36b2c1bb3ceb3cf74bfb98e4ebc65ee/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | handle($request); 26 | $response->send(); 27 | $kernel->terminate($request, $response); 28 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # www.robotstxt.org/ 2 | # www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449 3 | 4 | User-agent: * 5 | Disallow: 6 | -------------------------------------------------------------------------------- /src/Controller/PizzaController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\Controller; 13 | 14 | use App\Entity\Pizza; 15 | use App\Form\PizzaType; 16 | use App\Repository\PizzaRepository; 17 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; 18 | use Symfony\Component\HttpFoundation\Request; 19 | use Symfony\Component\HttpFoundation\Response; 20 | use Symfony\Component\Routing\Annotation\Route; 21 | 22 | /** 23 | * @Route("/pizza") 24 | */ 25 | class PizzaController extends AbstractController 26 | { 27 | /** 28 | * @Route("/", name="pizza_index", methods="GET") 29 | */ 30 | public function index(PizzaRepository $pizzaRepository): Response 31 | { 32 | return $this->render('pizza/index.html.twig', ['pizzas' => $pizzaRepository->findAll()]); 33 | } 34 | 35 | /** 36 | * @Route("/new", name="pizza_new", methods="GET|POST") 37 | */ 38 | public function new(Request $request): Response 39 | { 40 | $pizza = new Pizza(); 41 | $form = $this->createForm(PizzaType::class, $pizza); 42 | $form->handleRequest($request); 43 | 44 | if ($form->isSubmitted() && $form->isValid()) { 45 | $em = $this->getDoctrine()->getManager(); 46 | $em->persist($pizza); 47 | $em->flush(); 48 | 49 | return $this->redirectToRoute('pizza_index'); 50 | } 51 | 52 | return $this->render('pizza/new.html.twig', [ 53 | 'pizza' => $pizza, 54 | 'form' => $form->createView(), 55 | ]); 56 | } 57 | 58 | /** 59 | * @Route("/{id}", name="pizza_show", methods="GET") 60 | */ 61 | public function show(Pizza $pizza): Response 62 | { 63 | return $this->render('pizza/show.html.twig', ['pizza' => $pizza]); 64 | } 65 | 66 | /** 67 | * @Route("/{id}/edit", name="pizza_edit", methods="GET|POST") 68 | */ 69 | public function edit(Request $request, Pizza $pizza): Response 70 | { 71 | $form = $this->createForm(PizzaType::class, $pizza); 72 | $form->handleRequest($request); 73 | 74 | if ($form->isSubmitted() && $form->isValid()) { 75 | $this->getDoctrine()->getManager()->flush(); 76 | 77 | return $this->redirectToRoute('pizza_edit', ['id' => $pizza->getId()]); 78 | } 79 | 80 | return $this->render('pizza/edit.html.twig', [ 81 | 'pizza' => $pizza, 82 | 'form' => $form->createView(), 83 | ]); 84 | } 85 | 86 | /** 87 | * @Route("/{id}", name="pizza_delete", methods="DELETE") 88 | */ 89 | public function delete(Request $request, Pizza $pizza): Response 90 | { 91 | if (!$this->isCsrfTokenValid('delete'.$pizza->getId(), $request->request->get('_token'))) { 92 | return $this->redirectToRoute('pizza_index'); 93 | } 94 | 95 | $em = $this->getDoctrine()->getManager(); 96 | $em->remove($pizza); 97 | $em->flush(); 98 | 99 | return $this->redirectToRoute('pizza_index'); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/DataFixtures/AppFixtures.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\DataFixtures; 13 | 14 | use Doctrine\Bundle\FixturesBundle\Fixture; 15 | use Doctrine\Common\Persistence\ObjectManager; 16 | 17 | class AppFixtures extends Fixture 18 | { 19 | public function load(ObjectManager $manager) 20 | { 21 | // $product = new Product(); 22 | // $manager->persist($product); 23 | 24 | $manager->flush(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataFixtures/PizzaFixtures.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\DataFixtures; 13 | 14 | use App\Entity\Pizza; 15 | use Doctrine\Bundle\FixturesBundle\Fixture; 16 | use Doctrine\Common\Persistence\ObjectManager; 17 | 18 | class PizzaFixtures extends Fixture 19 | { 20 | public function load(ObjectManager $manager) 21 | { 22 | for ($i = 0; $i < 20; ++$i) { 23 | $pizza = new Pizza(); 24 | $pizza->setName('Pizza '.$i); 25 | $manager->persist($pizza); 26 | } 27 | 28 | $manager->flush(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Entity/Pizza.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\Entity; 13 | 14 | use Doctrine\ORM\Mapping as ORM; 15 | 16 | /** 17 | * @ORM\Entity(repositoryClass="App\Repository\PizzaRepository") 18 | */ 19 | class Pizza 20 | { 21 | /** 22 | * @ORM\Id() 23 | * @ORM\GeneratedValue() 24 | * @ORM\Column(type="integer") 25 | */ 26 | private $id; 27 | 28 | /** 29 | * @ORM\Column(type="string") 30 | */ 31 | private $name; 32 | 33 | public function getId(): ?int 34 | { 35 | return $this->id; 36 | } 37 | 38 | public function getName(): ?string 39 | { 40 | return $this->name; 41 | } 42 | 43 | public function setName(string $name): void 44 | { 45 | $this->name = $name; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Form/PizzaType.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\Form; 13 | 14 | use App\Entity\Pizza; 15 | use Symfony\Component\Form\AbstractType; 16 | use Symfony\Component\Form\FormBuilderInterface; 17 | use Symfony\Component\OptionsResolver\OptionsResolver; 18 | 19 | class PizzaType extends AbstractType 20 | { 21 | public function buildForm(FormBuilderInterface $builder, array $options) 22 | { 23 | $builder 24 | ->add('name') 25 | ; 26 | } 27 | 28 | public function configureOptions(OptionsResolver $resolver) 29 | { 30 | $resolver->setDefaults([ 31 | 'data_class' => Pizza::class, 32 | ]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Kernel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App; 13 | 14 | use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; 15 | use Symfony\Component\Config\Loader\LoaderInterface; 16 | use Symfony\Component\Config\Resource\FileResource; 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; 18 | use Symfony\Component\HttpKernel\Kernel as BaseKernel; 19 | use Symfony\Component\Routing\RouteCollectionBuilder; 20 | 21 | class Kernel extends BaseKernel 22 | { 23 | use MicroKernelTrait; 24 | 25 | private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; 26 | 27 | public function registerBundles(): iterable 28 | { 29 | $contents = require $this->getProjectDir().'/config/bundles.php'; 30 | foreach ($contents as $class => $envs) { 31 | if ($envs[$this->environment] ?? $envs['all'] ?? false) { 32 | yield new $class(); 33 | } 34 | } 35 | } 36 | 37 | public function getProjectDir(): string 38 | { 39 | return \dirname(__DIR__); 40 | } 41 | 42 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void 43 | { 44 | $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); 45 | $container->setParameter('container.dumper.inline_class_loader', true); 46 | $confDir = $this->getProjectDir().'/config'; 47 | 48 | $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); 49 | $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); 50 | $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); 51 | $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); 52 | } 53 | 54 | protected function configureRoutes(RouteCollectionBuilder $routes): void 55 | { 56 | $confDir = $this->getProjectDir().'/config'; 57 | 58 | $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); 59 | $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); 60 | $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Migrations/Version20171208151336.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace DoctrineMigrations; 13 | 14 | use Doctrine\DBAL\Schema\Schema; 15 | use Doctrine\Migrations\AbstractMigration; 16 | 17 | class Version20171208151336 extends AbstractMigration 18 | { 19 | public function up(Schema $schema): void 20 | { 21 | $this->addSql('CREATE TABLE foo (id INT AUTO_INCREMENT NOT NULL, bar VARCHAR(42) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 22 | } 23 | 24 | public function down(Schema $schema): void 25 | { 26 | $this->addSql('DROP TABLE foo'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Migrations/Version20180402204848.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace DoctrineMigrations; 13 | 14 | use Doctrine\DBAL\Schema\Schema; 15 | use Doctrine\Migrations\AbstractMigration; 16 | 17 | class Version20180402204848 extends AbstractMigration 18 | { 19 | public function up(Schema $schema): void 20 | { 21 | $this->addSql('CREATE TABLE pizza (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 22 | $this->addSql('DROP TABLE foo'); 23 | } 24 | 25 | public function down(Schema $schema): void 26 | { 27 | $this->addSql('CREATE TABLE foo (id INT AUTO_INCREMENT NOT NULL, bar VARCHAR(42) NOT NULL COLLATE utf8_unicode_ci, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); 28 | $this->addSql('DROP TABLE pizza'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Repository/PizzaRepository.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace App\Repository; 13 | 14 | use App\Entity\Pizza; 15 | use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; 16 | use Symfony\Bridge\Doctrine\RegistryInterface; 17 | 18 | /** 19 | * @method Pizza|null find($id, $lockMode = null, $lockVersion = null) 20 | * @method Pizza|null findOneBy(array $criteria, array $orderBy = null) 21 | * @method Pizza[] findAll() 22 | * @method Pizza[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) 23 | */ 24 | class PizzaRepository extends ServiceEntityRepository 25 | { 26 | public function __construct(RegistryInterface $registry) 27 | { 28 | parent::__construct($registry, Pizza::class); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /symfony.lock: -------------------------------------------------------------------------------- 1 | { 2 | "doctrine/annotations": { 3 | "version": "1.0", 4 | "recipe": { 5 | "repo": "github.com/symfony/recipes", 6 | "branch": "master", 7 | "version": "1.0", 8 | "ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672" 9 | }, 10 | "files": [ 11 | "config/routes/annotations.yaml" 12 | ] 13 | }, 14 | "doctrine/cache": { 15 | "version": "v1.8.0" 16 | }, 17 | "doctrine/collections": { 18 | "version": "v1.6.2" 19 | }, 20 | "doctrine/common": { 21 | "version": "v2.10.0" 22 | }, 23 | "doctrine/data-fixtures": { 24 | "version": "v1.3.1" 25 | }, 26 | "doctrine/dbal": { 27 | "version": "v2.9.2" 28 | }, 29 | "doctrine/doctrine-bundle": { 30 | "version": "1.6", 31 | "recipe": { 32 | "repo": "github.com/symfony/recipes", 33 | "branch": "master", 34 | "version": "1.6", 35 | "ref": "5e476e8edf3fa8e7f045ad034f89bb464424f5c1" 36 | }, 37 | "files": [ 38 | "config/packages/doctrine.yaml", 39 | "config/packages/prod/doctrine.yaml", 40 | "src/Entity/.gitignore", 41 | "src/Repository/.gitignore" 42 | ] 43 | }, 44 | "doctrine/doctrine-cache-bundle": { 45 | "version": "1.3.5" 46 | }, 47 | "doctrine/doctrine-fixtures-bundle": { 48 | "version": "3.0", 49 | "recipe": { 50 | "repo": "github.com/symfony/recipes", 51 | "branch": "master", 52 | "version": "3.0", 53 | "ref": "fc52d86631a6dfd9fdf3381d0b7e3df2069e51b3" 54 | }, 55 | "files": [ 56 | "src/DataFixtures/AppFixtures.php" 57 | ] 58 | }, 59 | "doctrine/doctrine-migrations-bundle": { 60 | "version": "1.2", 61 | "recipe": { 62 | "repo": "github.com/symfony/recipes", 63 | "branch": "master", 64 | "version": "1.2", 65 | "ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1" 66 | }, 67 | "files": [ 68 | "config/packages/doctrine_migrations.yaml", 69 | "src/Migrations/.gitignore" 70 | ] 71 | }, 72 | "doctrine/event-manager": { 73 | "version": "v1.0.0" 74 | }, 75 | "doctrine/inflector": { 76 | "version": "v1.3.0" 77 | }, 78 | "doctrine/instantiator": { 79 | "version": "1.2.0" 80 | }, 81 | "doctrine/lexer": { 82 | "version": "1.0.2" 83 | }, 84 | "doctrine/migrations": { 85 | "version": "v2.1.0" 86 | }, 87 | "doctrine/orm": { 88 | "version": "v2.6.3" 89 | }, 90 | "doctrine/persistence": { 91 | "version": "1.1.1" 92 | }, 93 | "doctrine/reflection": { 94 | "version": "v1.0.0" 95 | }, 96 | "jdorn/sql-formatter": { 97 | "version": "v1.2.17" 98 | }, 99 | "nikic/php-parser": { 100 | "version": "v4.2.2" 101 | }, 102 | "ocramius/package-versions": { 103 | "version": "1.4.0" 104 | }, 105 | "ocramius/proxy-manager": { 106 | "version": "2.2.2" 107 | }, 108 | "psr/cache": { 109 | "version": "1.0.1" 110 | }, 111 | "psr/container": { 112 | "version": "1.0.0" 113 | }, 114 | "psr/log": { 115 | "version": "1.1.0" 116 | }, 117 | "sensio/framework-extra-bundle": { 118 | "version": "5.2", 119 | "recipe": { 120 | "repo": "github.com/symfony/recipes", 121 | "branch": "master", 122 | "version": "5.2", 123 | "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" 124 | }, 125 | "files": [ 126 | "config/packages/sensio_framework_extra.yaml" 127 | ] 128 | }, 129 | "sensiolabs/security-checker": { 130 | "version": "4.0", 131 | "recipe": { 132 | "repo": "github.com/symfony/recipes", 133 | "branch": "master", 134 | "version": "4.0", 135 | "ref": "160c9b600564faa1224e8f387d49ef13ceb8b793" 136 | }, 137 | "files": [ 138 | "config/packages/security_checker.yaml" 139 | ] 140 | }, 141 | "symfony/asset": { 142 | "version": "v4.3.1" 143 | }, 144 | "symfony/cache": { 145 | "version": "v4.3.1" 146 | }, 147 | "symfony/cache-contracts": { 148 | "version": "v1.1.5" 149 | }, 150 | "symfony/config": { 151 | "version": "v4.3.1" 152 | }, 153 | "symfony/console": { 154 | "version": "3.3", 155 | "recipe": { 156 | "repo": "github.com/symfony/recipes", 157 | "branch": "master", 158 | "version": "3.3", 159 | "ref": "482d233eb8de91ebd042992077bbd5838858890c" 160 | }, 161 | "files": [ 162 | "bin/console", 163 | "config/bootstrap.php" 164 | ] 165 | }, 166 | "symfony/contracts": { 167 | "version": "v1.1.0" 168 | }, 169 | "symfony/debug": { 170 | "version": "v4.3.1" 171 | }, 172 | "symfony/debug-bundle": { 173 | "version": "4.1", 174 | "recipe": { 175 | "repo": "github.com/symfony/recipes", 176 | "branch": "master", 177 | "version": "4.1", 178 | "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea" 179 | }, 180 | "files": [ 181 | "config/packages/dev/debug.yaml" 182 | ] 183 | }, 184 | "symfony/dependency-injection": { 185 | "version": "v4.3.1" 186 | }, 187 | "symfony/doctrine-bridge": { 188 | "version": "v4.3.1" 189 | }, 190 | "symfony/dotenv": { 191 | "version": "v4.3.1" 192 | }, 193 | "symfony/event-dispatcher": { 194 | "version": "v4.3.1" 195 | }, 196 | "symfony/event-dispatcher-contracts": { 197 | "version": "v1.1.5" 198 | }, 199 | "symfony/filesystem": { 200 | "version": "v4.3.1" 201 | }, 202 | "symfony/finder": { 203 | "version": "v4.3.1" 204 | }, 205 | "symfony/flex": { 206 | "version": "1.0", 207 | "recipe": { 208 | "repo": "github.com/symfony/recipes", 209 | "branch": "master", 210 | "version": "1.0", 211 | "ref": "dc3fc2e0334a4137c47cfd5a3ececc601fa61a0b" 212 | }, 213 | "files": [ 214 | ".env" 215 | ] 216 | }, 217 | "symfony/form": { 218 | "version": "v4.3.1" 219 | }, 220 | "symfony/framework-bundle": { 221 | "version": "4.2", 222 | "recipe": { 223 | "repo": "github.com/symfony/recipes", 224 | "branch": "master", 225 | "version": "4.2", 226 | "ref": "61ad963f28c091b8bb9449507654b9c7d8bbb53c" 227 | }, 228 | "files": [ 229 | "config/bootstrap.php", 230 | "config/packages/cache.yaml", 231 | "config/packages/framework.yaml", 232 | "config/packages/test/framework.yaml", 233 | "config/services.yaml", 234 | "public/index.php", 235 | "src/Controller/.gitignore", 236 | "src/Kernel.php" 237 | ] 238 | }, 239 | "symfony/http-client": { 240 | "version": "v4.3.1" 241 | }, 242 | "symfony/http-client-contracts": { 243 | "version": "v1.1.5" 244 | }, 245 | "symfony/http-foundation": { 246 | "version": "v4.3.1" 247 | }, 248 | "symfony/http-kernel": { 249 | "version": "v4.3.1" 250 | }, 251 | "symfony/inflector": { 252 | "version": "v4.3.1" 253 | }, 254 | "symfony/intl": { 255 | "version": "v4.3.1" 256 | }, 257 | "symfony/maker-bundle": { 258 | "version": "1.0", 259 | "recipe": { 260 | "repo": "github.com/symfony/recipes", 261 | "branch": "master", 262 | "version": "1.0", 263 | "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" 264 | } 265 | }, 266 | "symfony/mime": { 267 | "version": "v4.3.1" 268 | }, 269 | "symfony/options-resolver": { 270 | "version": "v4.3.1" 271 | }, 272 | "symfony/orm-pack": { 273 | "version": "v1.0.6" 274 | }, 275 | "symfony/phpunit-bridge": { 276 | "version": "4.3", 277 | "recipe": { 278 | "repo": "github.com/symfony/recipes", 279 | "branch": "master", 280 | "version": "4.3", 281 | "ref": "b0582341f1df39aaf3a9a866cdbe49937da35984" 282 | }, 283 | "files": [ 284 | ".env.test", 285 | "bin/phpunit", 286 | "config/bootstrap.php", 287 | "phpunit.xml.dist", 288 | "tests/.gitignore" 289 | ] 290 | }, 291 | "symfony/polyfill-ctype": { 292 | "version": "v1.11.0" 293 | }, 294 | "symfony/polyfill-intl-icu": { 295 | "version": "v1.11.0" 296 | }, 297 | "symfony/polyfill-intl-idn": { 298 | "version": "v1.11.0" 299 | }, 300 | "symfony/polyfill-mbstring": { 301 | "version": "v1.11.0" 302 | }, 303 | "symfony/polyfill-php72": { 304 | "version": "v1.11.0" 305 | }, 306 | "symfony/polyfill-php73": { 307 | "version": "v1.11.0" 308 | }, 309 | "symfony/profiler-pack": { 310 | "version": "v1.0.4" 311 | }, 312 | "symfony/property-access": { 313 | "version": "v4.3.1" 314 | }, 315 | "symfony/routing": { 316 | "version": "4.2", 317 | "recipe": { 318 | "repo": "github.com/symfony/recipes", 319 | "branch": "master", 320 | "version": "4.2", 321 | "ref": "4c107a8d23a16b997178fbd4103b8d2f54f688b7" 322 | }, 323 | "files": [ 324 | "config/packages/dev/routing.yaml", 325 | "config/packages/routing.yaml", 326 | "config/packages/test/routing.yaml", 327 | "config/routes.yaml" 328 | ] 329 | }, 330 | "symfony/security-core": { 331 | "version": "v4.3.1" 332 | }, 333 | "symfony/security-csrf": { 334 | "version": "v4.3.1" 335 | }, 336 | "symfony/service-contracts": { 337 | "version": "v1.1.5" 338 | }, 339 | "symfony/stopwatch": { 340 | "version": "v4.3.1" 341 | }, 342 | "symfony/translation-contracts": { 343 | "version": "v1.1.5" 344 | }, 345 | "symfony/twig-bridge": { 346 | "version": "v4.3.1" 347 | }, 348 | "symfony/twig-bundle": { 349 | "version": "3.3", 350 | "recipe": { 351 | "repo": "github.com/symfony/recipes", 352 | "branch": "master", 353 | "version": "3.3", 354 | "ref": "369b5b29dc52b2c190002825ae7ec24ab6f962dd" 355 | }, 356 | "files": [ 357 | "config/packages/twig.yaml", 358 | "config/routes/dev/twig.yaml", 359 | "templates/base.html.twig" 360 | ] 361 | }, 362 | "symfony/validator": { 363 | "version": "4.3", 364 | "recipe": { 365 | "repo": "github.com/symfony/recipes", 366 | "branch": "master", 367 | "version": "4.3", 368 | "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869" 369 | }, 370 | "files": [ 371 | "config/packages/test/validator.yaml", 372 | "config/packages/validator.yaml" 373 | ] 374 | }, 375 | "symfony/var-dumper": { 376 | "version": "v4.3.1" 377 | }, 378 | "symfony/var-exporter": { 379 | "version": "v4.3.1" 380 | }, 381 | "symfony/web-profiler-bundle": { 382 | "version": "3.3", 383 | "recipe": { 384 | "repo": "github.com/symfony/recipes", 385 | "branch": "master", 386 | "version": "3.3", 387 | "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6" 388 | }, 389 | "files": [ 390 | "config/packages/dev/web_profiler.yaml", 391 | "config/packages/test/web_profiler.yaml", 392 | "config/routes/dev/web_profiler.yaml" 393 | ] 394 | }, 395 | "symfony/webpack-encore-bundle": { 396 | "version": "1.0", 397 | "recipe": { 398 | "repo": "github.com/symfony/recipes", 399 | "branch": "master", 400 | "version": "1.0", 401 | "ref": "faa1c4972a2b855edc2e113bcf9e1d84b02bf1de" 402 | }, 403 | "files": [ 404 | "assets/css/app.css", 405 | "assets/js/app.js", 406 | "config/packages/assets.yaml", 407 | "config/packages/prod/webpack_encore.yaml", 408 | "config/packages/webpack_encore.yaml", 409 | "package.json", 410 | "webpack.config.js" 411 | ] 412 | }, 413 | "symfony/yaml": { 414 | "version": "v4.3.1" 415 | }, 416 | "twig/twig": { 417 | "version": "v2.11.3" 418 | }, 419 | "zendframework/zend-code": { 420 | "version": "3.3.1" 421 | }, 422 | "zendframework/zend-eventmanager": { 423 | "version": "3.2.1" 424 | } 425 | } 426 | -------------------------------------------------------------------------------- /templates/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}Welcome!{% endblock %} 6 | {% block stylesheets %} 7 | {{ encore_entry_link_tags('app') }} 8 | {% endblock %} 9 | 10 | 11 | {% block body %}{% endblock %} 12 | {% block javascripts %} 13 | {{ encore_entry_script_tags('app') }} 14 | {% endblock %} 15 | 16 | 17 | -------------------------------------------------------------------------------- /templates/homepage.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block body %} 4 | {% for entity in entities %} 5 | {{ entity.bar }}
6 | {% endfor %} 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /templates/pizza/_delete_form.html.twig: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
-------------------------------------------------------------------------------- /templates/pizza/_form.html.twig: -------------------------------------------------------------------------------- 1 | {{ form_start(form) }} 2 | {{ form_widget(form) }} 3 | 4 | {{ form_end(form) }} -------------------------------------------------------------------------------- /templates/pizza/edit.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Edit Pizza{% endblock %} 4 | 5 | {% block body %} 6 |

Edit Pizza

7 | 8 | {{ include('pizza/_form.html.twig', {'button_label': 'Update'}) }} 9 | 10 | back to list 11 | 12 | {{ include('pizza/_delete_form.html.twig') }} 13 | {% endblock %} -------------------------------------------------------------------------------- /templates/pizza/index.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Pizza index{% endblock %} 4 | 5 | {% block body %} 6 |

Pizza index

7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% for pizza in pizzas %} 17 | 18 | 19 | 23 | 24 | {% else %} 25 | 26 | 27 | 28 | {% endfor %} 29 | 30 |
Idactions
{{ pizza.id }} 20 | show 21 | edit 22 |
no records found
31 | 32 | Create new 33 | {% endblock %} -------------------------------------------------------------------------------- /templates/pizza/new.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}New Pizza{% endblock %} 4 | 5 | {% block body %} 6 |

Create new Pizza

7 | 8 | {{ include('pizza/_form.html.twig') }} 9 | 10 | back to list 11 | {% endblock %} -------------------------------------------------------------------------------- /templates/pizza/show.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Pizza{% endblock %} 4 | 5 | {% block body %} 6 |

Pizza

7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Id{{ pizza.id }}
16 | 17 | back to list 18 | 19 | edit 20 | 21 | {{ include('pizza/_delete_form.html.twig') }} 22 | {% endblock %} -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mykiwi/symfony-bootstrapped/9d4d50b0a36b2c1bb3ceb3cf74bfb98e4ebc65ee/tests/.gitignore -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var Encore = require('@symfony/webpack-encore'); 2 | 3 | Encore 4 | // directory where compiled assets will be stored 5 | .setOutputPath('public/build/') 6 | // public path used by the web server to access the output path 7 | .setPublicPath('/build') 8 | // only needed for CDN's or sub-directory deploy 9 | //.setManifestKeyPrefix('build/') 10 | 11 | /* 12 | * ENTRY CONFIG 13 | * 14 | * Add 1 entry for each "page" of your app 15 | * (including one that's included on every page - e.g. "app") 16 | * 17 | * Each entry will result in one JavaScript file (e.g. app.js) 18 | * and one CSS file (e.g. app.css) if you JavaScript imports CSS. 19 | */ 20 | .addEntry('app', './assets/js/app.js') 21 | //.addEntry('page1', './assets/js/page1.js') 22 | //.addEntry('page2', './assets/js/page2.js') 23 | 24 | // will require an extra script tag for runtime.js 25 | // but, you probably want this, unless you're building a single-page app 26 | .enableSingleRuntimeChunk() 27 | 28 | .cleanupOutputBeforeBuild() 29 | .enableSourceMaps(!Encore.isProduction()) 30 | // enables hashed filenames (e.g. app.abc123.css) 31 | .enableVersioning(Encore.isProduction()) 32 | 33 | // uncomment if you use TypeScript 34 | //.enableTypeScriptLoader() 35 | 36 | // uncomment if you use Sass/SCSS files 37 | //.enableSassLoader() 38 | 39 | // uncomment if you're having problems with a jQuery plugin 40 | //.autoProvidejQuery() 41 | ; 42 | 43 | module.exports = Encore.getWebpackConfig(); 44 | --------------------------------------------------------------------------------