├── .env ├── .env.test ├── .gitignore ├── bin ├── console └── phpunit ├── composer.json ├── composer.lock ├── config ├── bundles.php ├── packages │ ├── dev │ │ ├── debug.yaml │ │ ├── easy_log_handler.yaml │ │ ├── monolog.yaml │ │ ├── routing.yaml │ │ ├── swiftmailer.yaml │ │ └── web_profiler.yaml │ ├── doctrine.yaml │ ├── doctrine_migrations.yaml │ ├── framework.yaml │ ├── prod │ │ ├── doctrine.yaml │ │ └── monolog.yaml │ ├── routing.yaml │ ├── security.yaml │ ├── sensio_framework_extra.yaml │ ├── swiftmailer.yaml │ ├── test │ │ ├── framework.yaml │ │ ├── monolog.yaml │ │ ├── routing.yaml │ │ ├── swiftmailer.yaml │ │ └── web_profiler.yaml │ ├── translation.yaml │ ├── twig.yaml │ └── validator.yaml ├── routes.yaml ├── routes │ ├── annotations.yaml │ └── dev │ │ ├── twig.yaml │ │ └── web_profiler.yaml └── services.yaml ├── phpunit.xml.dist ├── public └── index.php ├── readme.md ├── src ├── Controller │ ├── .gitignore │ ├── PostController.php │ └── SecurityController.php ├── DataFixtures │ └── AppFixtures.php ├── Entity │ ├── .gitignore │ ├── Post.php │ └── User.php ├── Kernel.php ├── Migrations │ ├── .gitignore │ └── Version20181114192832.php └── Repository │ ├── .gitignore │ ├── PostRepository.php │ └── UserRepository.php ├── symfony.lock ├── templates ├── base.html.twig ├── post │ └── index.html.twig └── security │ └── login.html.twig ├── tests └── .gitignore └── translations └── .gitignore /.env: -------------------------------------------------------------------------------- 1 | # This file defines all environment variables that the application needs. 2 | # Use ".env.local" for local overrides during development. 3 | # Use real environment variables when deploying to production. 4 | # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration 5 | 6 | ###> symfony/framework-bundle ### 7 | APP_ENV=dev 8 | APP_SECRET=b57b17cfc68b0391532e4e4af713a4fa 9 | #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 10 | #TRUSTED_HOSTS=localhost,example.com 11 | ###< symfony/framework-bundle ### 12 | 13 | ###> doctrine/doctrine-bundle ### 14 | # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url 15 | # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" 16 | # Configure your db driver and server_version in config/packages/doctrine.yaml 17 | DATABASE_URL=mysql://root:@127.0.0.1:3306/ajax 18 | ###< doctrine/doctrine-bundle ### 19 | 20 | ###> symfony/swiftmailer-bundle ### 21 | # For Gmail as a transport, use: "gmail://username:password@localhost" 22 | # For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" 23 | # Delivery is disabled by default via "null://localhost" 24 | MAILER_URL=null://localhost 25 | ###< symfony/swiftmailer-bundle ### 26 | -------------------------------------------------------------------------------- /.env.test: -------------------------------------------------------------------------------- 1 | # define your env variables for the test env here 2 | KERNEL_CLASS=App\\Kernel 3 | APP_SECRET='s$cretf0rt3st' 4 | SHELL_VERBOSITY=-1 5 | SYMFONY_DEPRECATIONS_HELPER=999999 6 | SYMFONY_PHPUNIT_VERSION=6.5 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ###> symfony/framework-bundle ### 3 | /.env.local 4 | /.env.*.local 5 | /public/bundles/ 6 | /var/ 7 | /vendor/ 8 | ###< symfony/framework-bundle ### 9 | 10 | ###> symfony/phpunit-bridge ### 11 | .phpunit 12 | /phpunit.xml 13 | ###< symfony/phpunit-bridge ### 14 | 15 | ###> symfony/web-server-bundle ### 16 | /.web-server-pid 17 | ###< symfony/web-server-bundle ### 18 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 30 | -------------------------------------------------------------------------------- /bin/phpunit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | unregister(); 12 | 13 | if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) { 14 | putenv('SYMFONY_PHPUNIT_REMOVE='); 15 | } 16 | if (false === getenv('SYMFONY_PHPUNIT_DIR')) { 17 | putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit'); 18 | } 19 | 20 | require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit'; 21 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "project", 3 | "license": "proprietary", 4 | "require": { 5 | "php": "^7.1.3", 6 | "ext-ctype": "*", 7 | "ext-iconv": "*", 8 | "doctrine/doctrine-fixtures-bundle": "^3.0", 9 | "fzaninotto/faker": "^1.8", 10 | "sensio/framework-extra-bundle": "^5.1", 11 | "symfony/asset": "4.1.*", 12 | "symfony/console": "4.1.*", 13 | "symfony/expression-language": "4.1.*", 14 | "symfony/flex": "^1.1", 15 | "symfony/form": "4.1.*", 16 | "symfony/framework-bundle": "4.1.*", 17 | "symfony/monolog-bundle": "^3.1", 18 | "symfony/orm-pack": "*", 19 | "symfony/process": "4.1.*", 20 | "symfony/security-bundle": "4.1.*", 21 | "symfony/serializer-pack": "*", 22 | "symfony/swiftmailer-bundle": "^3.1", 23 | "symfony/translation": "4.1.*", 24 | "symfony/twig-bundle": "4.1.*", 25 | "symfony/validator": "4.1.*", 26 | "symfony/web-link": "4.1.*", 27 | "symfony/yaml": "4.1.*" 28 | }, 29 | "require-dev": { 30 | "symfony/debug-pack": "*", 31 | "symfony/dotenv": "4.1.*", 32 | "symfony/maker-bundle": "^1.0", 33 | "symfony/profiler-pack": "*", 34 | "symfony/test-pack": "*", 35 | "symfony/web-server-bundle": "4.1.*" 36 | }, 37 | "config": { 38 | "preferred-install": { 39 | "*": "dist" 40 | }, 41 | "sort-packages": true 42 | }, 43 | "autoload": { 44 | "psr-4": { 45 | "App\\": "src/" 46 | } 47 | }, 48 | "autoload-dev": { 49 | "psr-4": { 50 | "App\\Tests\\": "tests/" 51 | } 52 | }, 53 | "replace": { 54 | "paragonie/random_compat": "2.*", 55 | "symfony/polyfill-ctype": "*", 56 | "symfony/polyfill-iconv": "*", 57 | "symfony/polyfill-php71": "*", 58 | "symfony/polyfill-php70": "*", 59 | "symfony/polyfill-php56": "*" 60 | }, 61 | "scripts": { 62 | "auto-scripts": { 63 | "cache:clear": "symfony-cmd", 64 | "assets:install %PUBLIC_DIR%": "symfony-cmd" 65 | }, 66 | "post-install-cmd": [ 67 | "@auto-scripts" 68 | ], 69 | "post-update-cmd": [ 70 | "@auto-scripts" 71 | ] 72 | }, 73 | "conflict": { 74 | "symfony/symfony": "*" 75 | }, 76 | "extra": { 77 | "symfony": { 78 | "allow-contrib": false, 79 | "require": "4.1.*" 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], 6 | Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], 7 | Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], 8 | Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], 9 | Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], 10 | Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], 11 | Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], 12 | Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], 13 | Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], 14 | Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], 15 | Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], 16 | Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true], 17 | Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], 18 | ]; 19 | -------------------------------------------------------------------------------- /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/easy_log_handler.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | EasyCorp\EasyLog\EasyLogHandler: 3 | public: false 4 | arguments: ['%kernel.logs_dir%/%kernel.environment%.log'] 5 | 6 | #// FIXME: How to add this configuration automatically without messing up with the monolog configuration? 7 | #monolog: 8 | # handlers: 9 | # buffered: 10 | # type: buffer 11 | # handler: easylog 12 | # channels: ['!event'] 13 | # level: debug 14 | # easylog: 15 | # type: service 16 | # id: EasyCorp\EasyLog\EasyLogHandler 17 | -------------------------------------------------------------------------------- /config/packages/dev/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: stream 5 | path: "%kernel.logs_dir%/%kernel.environment%.log" 6 | level: debug 7 | channels: ["!event"] 8 | # uncomment to get logging in your browser 9 | # you may have to allow bigger header sizes in your Web server configuration 10 | #firephp: 11 | # type: firephp 12 | # level: info 13 | #chromephp: 14 | # type: chromephp 15 | # level: info 16 | console: 17 | type: console 18 | process_psr_3_messages: false 19 | channels: ["!event", "!doctrine", "!console"] 20 | -------------------------------------------------------------------------------- /config/packages/dev/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /config/packages/dev/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | # See https://symfony.com/doc/current/email/dev_environment.html 2 | swiftmailer: 3 | # send all emails to a specific address 4 | #delivery_addresses: ['me@example.com'] 5 | -------------------------------------------------------------------------------- /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 | parameters: 2 | # Adds a fallback DATABASE_URL if the env var is not set. 3 | # This allows you to run cache:warmup even if your 4 | # environment variables are not available yet. 5 | # You should not need to change this value. 6 | env(DATABASE_URL): '' 7 | 8 | doctrine: 9 | dbal: 10 | # configure these for your database server 11 | driver: 'pdo_mysql' 12 | server_version: '5.7' 13 | charset: utf8mb4 14 | default_table_options: 15 | charset: utf8mb4 16 | collate: utf8mb4_unicode_ci 17 | 18 | url: '%env(resolve:DATABASE_URL)%' 19 | orm: 20 | auto_generate_proxy_classes: true 21 | naming_strategy: doctrine.orm.naming_strategy.underscore 22 | auto_mapping: true 23 | mappings: 24 | App: 25 | is_bundle: false 26 | type: annotation 27 | dir: '%kernel.project_dir%/src/Entity' 28 | prefix: 'App\Entity' 29 | alias: App 30 | -------------------------------------------------------------------------------- /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 | #default_locale: en 4 | #csrf_protection: true 5 | #http_method_override: true 6 | 7 | # Enables session support. Note that the session will ONLY be started if you read or write from it. 8 | # Remove or comment this section to explicitly disable session support. 9 | session: 10 | handler_id: ~ 11 | 12 | #esi: true 13 | #fragments: true 14 | php_errors: 15 | log: true 16 | 17 | cache: 18 | # Put the unique name of your app here: the prefix seed 19 | # is used to compute stable namespaces for cache keys. 20 | #prefix_seed: your_vendor_name/app_name 21 | 22 | # The app cache caches to the filesystem by default. 23 | # Other options include: 24 | 25 | # Redis 26 | #app: cache.adapter.redis 27 | #default_redis_provider: redis://localhost 28 | 29 | # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) 30 | #app: cache.adapter.apcu 31 | -------------------------------------------------------------------------------- /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/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: fingers_crossed 5 | action_level: error 6 | handler: nested 7 | excluded_404s: 8 | # regex: exclude all 404 errors from the logs 9 | - ^/ 10 | nested: 11 | type: stream 12 | path: "%kernel.logs_dir%/%kernel.environment%.log" 13 | level: debug 14 | console: 15 | type: console 16 | process_psr_3_messages: false 17 | channels: ["!event", "!doctrine"] 18 | deprecation: 19 | type: stream 20 | path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" 21 | deprecation_filter: 22 | type: filter 23 | handler: deprecation 24 | max_level: info 25 | channels: ["php"] 26 | -------------------------------------------------------------------------------- /config/packages/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: ~ 4 | -------------------------------------------------------------------------------- /config/packages/security.yaml: -------------------------------------------------------------------------------- 1 | security: 2 | encoders: 3 | App\Entity\User: 4 | algorithm: argon2i 5 | 6 | # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers 7 | providers: 8 | # used to reload user from session & other features (e.g. switch_user) 9 | app_user_provider: 10 | entity: 11 | class: App\Entity\User 12 | property: email 13 | firewalls: 14 | dev: 15 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 16 | security: false 17 | main: 18 | anonymous: true 19 | provider: app_user_provider 20 | form_login: 21 | login_path: login 22 | check_path: login 23 | logout: 24 | path: logout 25 | target: homepage 26 | 27 | # activate different ways to authenticate 28 | # http_basic: true 29 | # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate 30 | # form_login: true 31 | # https://symfony.com/doc/current/security/form_login_setup.html 32 | 33 | # Easy way to control access for large sections of your site 34 | # Note: Only the *first* access control that matches will be used 35 | access_control: 36 | # - { path: ^/admin, roles: ROLE_ADMIN } 37 | # - { path: ^/profile, roles: ROLE_USER } 38 | -------------------------------------------------------------------------------- /config/packages/sensio_framework_extra.yaml: -------------------------------------------------------------------------------- 1 | sensio_framework_extra: 2 | router: 3 | annotations: false 4 | -------------------------------------------------------------------------------- /config/packages/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | url: '%env(MAILER_URL)%' 3 | spool: { type: 'memory' } 4 | -------------------------------------------------------------------------------- /config/packages/test/framework.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | test: true 3 | session: 4 | storage_id: session.storage.mock_file 5 | -------------------------------------------------------------------------------- /config/packages/test/monolog.yaml: -------------------------------------------------------------------------------- 1 | monolog: 2 | handlers: 3 | main: 4 | type: stream 5 | path: "%kernel.logs_dir%/%kernel.environment%.log" 6 | level: debug 7 | channels: ["!event"] 8 | -------------------------------------------------------------------------------- /config/packages/test/routing.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | router: 3 | strict_requirements: true 4 | -------------------------------------------------------------------------------- /config/packages/test/swiftmailer.yaml: -------------------------------------------------------------------------------- 1 | swiftmailer: 2 | disable_delivery: true 3 | -------------------------------------------------------------------------------- /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/translation.yaml: -------------------------------------------------------------------------------- 1 | framework: 2 | default_locale: '%locale%' 3 | translator: 4 | default_path: '%kernel.project_dir%/translations' 5 | fallbacks: 6 | - '%locale%' 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 | -------------------------------------------------------------------------------- /config/routes.yaml: -------------------------------------------------------------------------------- 1 | #index: 2 | # path: / 3 | # controller: App\Controller\DefaultController::index 4 | -------------------------------------------------------------------------------- /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 | locale: 'en' 8 | 9 | services: 10 | # default configuration for services in *this* file 11 | _defaults: 12 | autowire: true # Automatically injects dependencies in your services. 13 | autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. 14 | public: false # Allows optimizing the container by removing unused services; this also means 15 | # fetching services directly from the container via $container->get() won't work. 16 | # The best practice is to be explicit about your dependencies anyway. 17 | 18 | # makes classes in src/ available to be used as services 19 | # this creates a service per class whose id is the fully-qualified class name 20 | App\: 21 | resource: '../src/*' 22 | exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' 23 | 24 | # controllers are imported separately to make sure services can be injected 25 | # as action arguments even if you don't extend any base controller class 26 | App\Controller\: 27 | resource: '../src/Controller' 28 | tags: ['controller.service_arguments'] 29 | 30 | # add more service definitions when explicit configuration is needed 31 | # please note that last definitions always *replace* previous ones 32 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | tests 17 | 18 | 19 | 20 | 21 | 22 | src 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | handle($request); 28 | $response->send(); 29 | $kernel->terminate($request, $response); 30 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Codebase pour l'initiation à AJAX avec Symfony 2 | Ce code sert uniquement à la vidéo d'initiation à AJAX avec Symfony ! 3 | 4 | # Installation 5 | ``` 6 | # On clone le dépot les bros ! 7 | git clone https://github.com/liorchamla/cours-ajax.git 8 | 9 | # On se déplace dans le dossier 10 | cd cours-ajax 11 | 12 | # On installe les dépendances ! 13 | composer install 14 | 15 | # On créé la base de données 16 | php bin/console doctrine:database:create 17 | 18 | # On exécute les migrations 19 | php bin/console doctrine:migrations:migrate 20 | 21 | # On exécute la fixture 22 | php bin/console doctrine:fixtures:load --no-interaction 23 | 24 | # On lance le serveur 25 | php bin/console server:run 26 | ``` 27 | -------------------------------------------------------------------------------- /src/Controller/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/src/Controller/.gitignore -------------------------------------------------------------------------------- /src/Controller/PostController.php: -------------------------------------------------------------------------------- 1 | render('post/index.html.twig', [ 17 | 'posts' => $repo->findAll(), 18 | ]); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Controller/SecurityController.php: -------------------------------------------------------------------------------- 1 | render('security/login.html.twig'); 17 | } 18 | 19 | /** 20 | * @Route("/logout", name="logout") 21 | */ 22 | public function logout() 23 | { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DataFixtures/AppFixtures.php: -------------------------------------------------------------------------------- 1 | encoder = $encoder; 24 | } 25 | 26 | public function load(ObjectManager $manager) 27 | { 28 | $faker = Factory::create(); 29 | 30 | $user = new User(); 31 | $user->setEmail('user@symfony.com') 32 | ->setPassword($this->encoder->encodePassword($user, 'password')); 33 | 34 | $manager->persist($user); 35 | 36 | for ($i = 0; $i < 20; $i++) { 37 | $post = new Post(); 38 | $post->setTitle($faker->sentence(6)) 39 | ->setIntroduction($faker->paragraph()) 40 | ->setContent('

' . join(',', $faker->paragraphs()) . '

'); 41 | 42 | $manager->persist($post); 43 | } 44 | 45 | $manager->flush(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Entity/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/src/Entity/.gitignore -------------------------------------------------------------------------------- /src/Entity/Post.php: -------------------------------------------------------------------------------- 1 | id; 37 | } 38 | 39 | public function getTitle(): ?string 40 | { 41 | return $this->title; 42 | } 43 | 44 | public function setTitle(string $title): self 45 | { 46 | $this->title = $title; 47 | 48 | return $this; 49 | } 50 | 51 | public function getIntroduction(): ?string 52 | { 53 | return $this->introduction; 54 | } 55 | 56 | public function setIntroduction(string $introduction): self 57 | { 58 | $this->introduction = $introduction; 59 | 60 | return $this; 61 | } 62 | 63 | public function getContent(): ?string 64 | { 65 | return $this->content; 66 | } 67 | 68 | public function setContent(string $content): self 69 | { 70 | $this->content = $content; 71 | 72 | return $this; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Entity/User.php: -------------------------------------------------------------------------------- 1 | id; 39 | } 40 | 41 | public function getEmail(): ?string 42 | { 43 | return $this->email; 44 | } 45 | 46 | public function setEmail(string $email): self 47 | { 48 | $this->email = $email; 49 | 50 | return $this; 51 | } 52 | 53 | /** 54 | * A visual identifier that represents this user. 55 | * 56 | * @see UserInterface 57 | */ 58 | public function getUsername(): string 59 | { 60 | return (string) $this->email; 61 | } 62 | 63 | /** 64 | * @see UserInterface 65 | */ 66 | public function getRoles(): array 67 | { 68 | $roles = $this->roles; 69 | // guarantee every user at least has ROLE_USER 70 | $roles[] = 'ROLE_USER'; 71 | 72 | return array_unique($roles); 73 | } 74 | 75 | public function setRoles(array $roles): self 76 | { 77 | $this->roles = $roles; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * @see UserInterface 84 | */ 85 | public function getPassword(): string 86 | { 87 | return (string) $this->password; 88 | } 89 | 90 | public function setPassword(string $password): self 91 | { 92 | $this->password = $password; 93 | 94 | return $this; 95 | } 96 | 97 | /** 98 | * @see UserInterface 99 | */ 100 | public function getSalt() 101 | { 102 | // not needed when using the "bcrypt" algorithm in security.yaml 103 | } 104 | 105 | /** 106 | * @see UserInterface 107 | */ 108 | public function eraseCredentials() 109 | { 110 | // If you store any temporary, sensitive data on the user, clear it here 111 | // $this->plainPassword = null; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/Kernel.php: -------------------------------------------------------------------------------- 1 | getProjectDir().'/var/cache/'.$this->environment; 22 | } 23 | 24 | public function getLogDir() 25 | { 26 | return $this->getProjectDir().'/var/log'; 27 | } 28 | 29 | public function registerBundles() 30 | { 31 | $contents = require $this->getProjectDir().'/config/bundles.php'; 32 | foreach ($contents as $class => $envs) { 33 | if (isset($envs['all']) || isset($envs[$this->environment])) { 34 | yield new $class(); 35 | } 36 | } 37 | } 38 | 39 | protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) 40 | { 41 | $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); 42 | // Feel free to remove the "container.autowiring.strict_mode" parameter 43 | // if you are using symfony/dependency-injection 4.0+ as it's the default behavior 44 | $container->setParameter('container.autowiring.strict_mode', true); 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) 55 | { 56 | $confDir = $this->getProjectDir().'/config'; 57 | 58 | $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob'); 59 | $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); 60 | $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); 61 | } 62 | 63 | public static function bootstrapCli(array &$argv) 64 | { 65 | // consume --env and --no-debug from the command line 66 | 67 | // when using symfony/console v4.2 or higher, this should 68 | // be replaced by a call to Application::bootstrapEnv() 69 | 70 | for ($i = 0; $i < \count($argv) && '--' !== $v = $argv[$i]; ++$i) { 71 | if ('--no-debug' === $v) { 72 | putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); 73 | $argvUnset[$i] = true; 74 | break; 75 | } 76 | } 77 | 78 | for ($i = 0; $i < \count($argv) && '--' !== $v = $argv[$i]; ++$i) { 79 | if (!$v || '-' !== $v[0] || !preg_match('/^-(?:-env(?:=|$)|e=?)(.*)$/D', $v, $v)) { 80 | continue; 81 | } 82 | if (!empty($v[1]) || !empty($argv[1 + $i])) { 83 | putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = empty($v[1]) ? $argv[1 + $i] : $v[1]); 84 | $argvUnset[$i] = $argvUnset[$i + empty($v[1])] = true; 85 | } 86 | break; 87 | } 88 | 89 | if (!empty($argvUnset)) { 90 | $argv = array_values(array_diff_key($argv, $argvUnset)); 91 | } 92 | } 93 | 94 | public static function bootstrapEnv($env = null) 95 | { 96 | if (null !== $env) { 97 | putenv('APP_ENV='.$_SERVER['APP_ENV'] = $env); 98 | } 99 | 100 | if ('prod' !== $_SERVER['APP_ENV'] = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) { 101 | if (!class_exists(Dotenv::class)) { 102 | throw new \RuntimeException('The "APP_ENV" environment variable is not defined. You need to set it or run "composer require symfony/dotenv" to load it from a ".env" file.'); 103 | } 104 | 105 | // when using symfony/dotenv v4.2 or higher, this call and the related methods 106 | // below should be replaced by a call to the new Dotenv::loadEnv() method 107 | self::loadEnv(new Dotenv(), \dirname(__DIR__).'/.env'); 108 | } 109 | 110 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'dev'; 111 | $_SERVER['APP_DEBUG'] = isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : 'prod' !== $_SERVER['APP_ENV']); 112 | $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; 113 | } 114 | 115 | private static function loadEnv(Dotenv $dotenv, $path) 116 | { 117 | if (file_exists($path) || !file_exists($p = "$path.dist")) { 118 | $dotenv->load($path); 119 | } else { 120 | $dotenv->load($p); 121 | } 122 | 123 | if (null === $env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) { 124 | $dotenv->populate(array('APP_ENV' => $env = 'dev')); 125 | } 126 | 127 | if ('test' !== $env && file_exists($p = "$path.local")) { 128 | $dotenv->load($p); 129 | $env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : $env); 130 | } 131 | 132 | if (file_exists($p = "$path.$env")) { 133 | $dotenv->load($p); 134 | } 135 | 136 | if (file_exists($p = "$path.$env.local")) { 137 | $dotenv->load($p); 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/Migrations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/src/Migrations/.gitignore -------------------------------------------------------------------------------- /src/Migrations/Version20181114192832.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 17 | 18 | $this->addSql('CREATE TABLE post (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, introduction LONGTEXT NOT NULL, content LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 19 | $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); 20 | } 21 | 22 | public function down(Schema $schema) : void 23 | { 24 | // this down() migration is auto-generated, please modify it to your needs 25 | $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); 26 | 27 | $this->addSql('DROP TABLE post'); 28 | $this->addSql('DROP TABLE user'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Repository/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/src/Repository/.gitignore -------------------------------------------------------------------------------- /src/Repository/PostRepository.php: -------------------------------------------------------------------------------- 1 | createQueryBuilder('p') 29 | ->andWhere('p.exampleField = :val') 30 | ->setParameter('val', $value) 31 | ->orderBy('p.id', 'ASC') 32 | ->setMaxResults(10) 33 | ->getQuery() 34 | ->getResult() 35 | ; 36 | } 37 | */ 38 | 39 | /* 40 | public function findOneBySomeField($value): ?Post 41 | { 42 | return $this->createQueryBuilder('p') 43 | ->andWhere('p.exampleField = :val') 44 | ->setParameter('val', $value) 45 | ->getQuery() 46 | ->getOneOrNullResult() 47 | ; 48 | } 49 | */ 50 | } 51 | -------------------------------------------------------------------------------- /src/Repository/UserRepository.php: -------------------------------------------------------------------------------- 1 | createQueryBuilder('u') 29 | ->andWhere('u.exampleField = :val') 30 | ->setParameter('val', $value) 31 | ->orderBy('u.id', 'ASC') 32 | ->setMaxResults(10) 33 | ->getQuery() 34 | ->getResult() 35 | ; 36 | } 37 | */ 38 | 39 | /* 40 | public function findOneBySomeField($value): ?User 41 | { 42 | return $this->createQueryBuilder('u') 43 | ->andWhere('u.exampleField = :val') 44 | ->setParameter('val', $value) 45 | ->getQuery() 46 | ->getOneOrNullResult() 47 | ; 48 | } 49 | */ 50 | } 51 | -------------------------------------------------------------------------------- /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 | }, 11 | "doctrine/cache": { 12 | "version": "v1.8.0" 13 | }, 14 | "doctrine/collections": { 15 | "version": "v1.5.0" 16 | }, 17 | "doctrine/common": { 18 | "version": "v2.9.0" 19 | }, 20 | "doctrine/data-fixtures": { 21 | "version": "v1.3.1" 22 | }, 23 | "doctrine/dbal": { 24 | "version": "v2.8.0" 25 | }, 26 | "doctrine/doctrine-bundle": { 27 | "version": "1.6", 28 | "recipe": { 29 | "repo": "github.com/symfony/recipes", 30 | "branch": "master", 31 | "version": "1.6", 32 | "ref": "453e89b78ded666f351617baca5ae40d20622351" 33 | } 34 | }, 35 | "doctrine/doctrine-cache-bundle": { 36 | "version": "1.3.5" 37 | }, 38 | "doctrine/doctrine-fixtures-bundle": { 39 | "version": "3.0", 40 | "recipe": { 41 | "repo": "github.com/symfony/recipes", 42 | "branch": "master", 43 | "version": "3.0", 44 | "ref": "fc52d86631a6dfd9fdf3381d0b7e3df2069e51b3" 45 | } 46 | }, 47 | "doctrine/doctrine-migrations-bundle": { 48 | "version": "1.2", 49 | "recipe": { 50 | "repo": "github.com/symfony/recipes", 51 | "branch": "master", 52 | "version": "1.2", 53 | "ref": "c1431086fec31f17fbcfe6d6d7e92059458facc1" 54 | } 55 | }, 56 | "doctrine/event-manager": { 57 | "version": "v1.0.0" 58 | }, 59 | "doctrine/inflector": { 60 | "version": "v1.3.0" 61 | }, 62 | "doctrine/instantiator": { 63 | "version": "1.1.0" 64 | }, 65 | "doctrine/lexer": { 66 | "version": "v1.0.1" 67 | }, 68 | "doctrine/migrations": { 69 | "version": "v1.8.1" 70 | }, 71 | "doctrine/orm": { 72 | "version": "v2.6.2" 73 | }, 74 | "doctrine/persistence": { 75 | "version": "v1.0.1" 76 | }, 77 | "doctrine/reflection": { 78 | "version": "v1.0.0" 79 | }, 80 | "easycorp/easy-log-handler": { 81 | "version": "1.0", 82 | "recipe": { 83 | "repo": "github.com/symfony/recipes", 84 | "branch": "master", 85 | "version": "1.0", 86 | "ref": "70062abc2cd58794d2a90274502f81b55cd9951b" 87 | } 88 | }, 89 | "egulias/email-validator": { 90 | "version": "2.1.6" 91 | }, 92 | "facebook/webdriver": { 93 | "version": "1.6.0" 94 | }, 95 | "fig/link-util": { 96 | "version": "1.0.0" 97 | }, 98 | "fzaninotto/faker": { 99 | "version": "v1.8.0" 100 | }, 101 | "jdorn/sql-formatter": { 102 | "version": "v1.2.17" 103 | }, 104 | "monolog/monolog": { 105 | "version": "1.24.0" 106 | }, 107 | "nikic/php-parser": { 108 | "version": "v4.1.0" 109 | }, 110 | "ocramius/proxy-manager": { 111 | "version": "2.1.1" 112 | }, 113 | "phpdocumentor/reflection-common": { 114 | "version": "1.0.1" 115 | }, 116 | "phpdocumentor/reflection-docblock": { 117 | "version": "4.3.0" 118 | }, 119 | "phpdocumentor/type-resolver": { 120 | "version": "0.4.0" 121 | }, 122 | "psr/cache": { 123 | "version": "1.0.1" 124 | }, 125 | "psr/container": { 126 | "version": "1.0.0" 127 | }, 128 | "psr/link": { 129 | "version": "1.0.0" 130 | }, 131 | "psr/log": { 132 | "version": "1.0.2" 133 | }, 134 | "psr/simple-cache": { 135 | "version": "1.0.1" 136 | }, 137 | "sensio/framework-extra-bundle": { 138 | "version": "5.2", 139 | "recipe": { 140 | "repo": "github.com/symfony/recipes", 141 | "branch": "master", 142 | "version": "5.2", 143 | "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" 144 | } 145 | }, 146 | "swiftmailer/swiftmailer": { 147 | "version": "v6.1.3" 148 | }, 149 | "symfony/asset": { 150 | "version": "v4.1.7" 151 | }, 152 | "symfony/browser-kit": { 153 | "version": "v4.1.7" 154 | }, 155 | "symfony/cache": { 156 | "version": "v4.1.7" 157 | }, 158 | "symfony/config": { 159 | "version": "v4.1.7" 160 | }, 161 | "symfony/console": { 162 | "version": "3.3", 163 | "recipe": { 164 | "repo": "github.com/symfony/recipes", 165 | "branch": "master", 166 | "version": "3.3", 167 | "ref": "b5026d7ffdb43b4d66f4cc091b1e6f94e6023986" 168 | } 169 | }, 170 | "symfony/css-selector": { 171 | "version": "v4.1.7" 172 | }, 173 | "symfony/debug": { 174 | "version": "v4.1.7" 175 | }, 176 | "symfony/debug-bundle": { 177 | "version": "4.1", 178 | "recipe": { 179 | "repo": "github.com/symfony/recipes", 180 | "branch": "master", 181 | "version": "4.1", 182 | "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea" 183 | } 184 | }, 185 | "symfony/debug-pack": { 186 | "version": "v1.0.6" 187 | }, 188 | "symfony/dependency-injection": { 189 | "version": "v4.1.7" 190 | }, 191 | "symfony/doctrine-bridge": { 192 | "version": "v4.1.7" 193 | }, 194 | "symfony/dom-crawler": { 195 | "version": "v4.1.7" 196 | }, 197 | "symfony/dotenv": { 198 | "version": "v4.1.7" 199 | }, 200 | "symfony/event-dispatcher": { 201 | "version": "v4.1.7" 202 | }, 203 | "symfony/expression-language": { 204 | "version": "v4.1.7" 205 | }, 206 | "symfony/filesystem": { 207 | "version": "v4.1.7" 208 | }, 209 | "symfony/finder": { 210 | "version": "v4.1.7" 211 | }, 212 | "symfony/flex": { 213 | "version": "1.0", 214 | "recipe": { 215 | "repo": "github.com/symfony/recipes", 216 | "branch": "master", 217 | "version": "1.0", 218 | "ref": "b96338eb5155c5b97a80e7705abf30aa09c29167" 219 | } 220 | }, 221 | "symfony/form": { 222 | "version": "v4.1.7" 223 | }, 224 | "symfony/framework-bundle": { 225 | "version": "3.3", 226 | "recipe": { 227 | "repo": "github.com/symfony/recipes", 228 | "branch": "master", 229 | "version": "3.3", 230 | "ref": "2230e9f42b10616b91a28d15ed3a2d984e0b6c10" 231 | } 232 | }, 233 | "symfony/http-foundation": { 234 | "version": "v4.1.7" 235 | }, 236 | "symfony/http-kernel": { 237 | "version": "v4.1.7" 238 | }, 239 | "symfony/inflector": { 240 | "version": "v4.1.7" 241 | }, 242 | "symfony/intl": { 243 | "version": "v4.1.7" 244 | }, 245 | "symfony/maker-bundle": { 246 | "version": "1.0", 247 | "recipe": { 248 | "repo": "github.com/symfony/recipes", 249 | "branch": "master", 250 | "version": "1.0", 251 | "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" 252 | } 253 | }, 254 | "symfony/monolog-bridge": { 255 | "version": "v4.1.7" 256 | }, 257 | "symfony/monolog-bundle": { 258 | "version": "3.1", 259 | "recipe": { 260 | "repo": "github.com/symfony/recipes", 261 | "branch": "master", 262 | "version": "3.1", 263 | "ref": "18ebf5a940573a20de06f9c4060101eeb438cf3d" 264 | } 265 | }, 266 | "symfony/options-resolver": { 267 | "version": "v4.1.7" 268 | }, 269 | "symfony/orm-pack": { 270 | "version": "v1.0.5" 271 | }, 272 | "symfony/panther": { 273 | "version": "v0.2.0" 274 | }, 275 | "symfony/phpunit-bridge": { 276 | "version": "4.1", 277 | "recipe": { 278 | "repo": "github.com/symfony/recipes", 279 | "branch": "master", 280 | "version": "4.1", 281 | "ref": "e637a1337f5faf0b2529b1c9a47de5e8286679f0" 282 | } 283 | }, 284 | "symfony/polyfill-intl-icu": { 285 | "version": "v1.10.0" 286 | }, 287 | "symfony/polyfill-mbstring": { 288 | "version": "v1.10.0" 289 | }, 290 | "symfony/polyfill-php72": { 291 | "version": "v1.10.0" 292 | }, 293 | "symfony/process": { 294 | "version": "v4.1.7" 295 | }, 296 | "symfony/profiler-pack": { 297 | "version": "v1.0.3" 298 | }, 299 | "symfony/property-access": { 300 | "version": "v4.1.7" 301 | }, 302 | "symfony/property-info": { 303 | "version": "v4.1.7" 304 | }, 305 | "symfony/routing": { 306 | "version": "4.0", 307 | "recipe": { 308 | "repo": "github.com/symfony/recipes", 309 | "branch": "master", 310 | "version": "4.0", 311 | "ref": "5f514d9d3b8a8aac3d62ae6a86b18b90ed0c7826" 312 | } 313 | }, 314 | "symfony/security": { 315 | "version": "v4.1.7" 316 | }, 317 | "symfony/security-bundle": { 318 | "version": "3.3", 319 | "recipe": { 320 | "repo": "github.com/symfony/recipes", 321 | "branch": "master", 322 | "version": "3.3", 323 | "ref": "f8a63faa0d9521526499c0a8f403c9964ecb0527" 324 | } 325 | }, 326 | "symfony/serializer": { 327 | "version": "v4.1.7" 328 | }, 329 | "symfony/serializer-pack": { 330 | "version": "v1.0.1" 331 | }, 332 | "symfony/stopwatch": { 333 | "version": "v4.1.7" 334 | }, 335 | "symfony/swiftmailer-bundle": { 336 | "version": "2.5", 337 | "recipe": { 338 | "repo": "github.com/symfony/recipes", 339 | "branch": "master", 340 | "version": "2.5", 341 | "ref": "3db029c03e452b4a23f7fc45cec7c922c2247eb8" 342 | } 343 | }, 344 | "symfony/test-pack": { 345 | "version": "v1.0.4" 346 | }, 347 | "symfony/translation": { 348 | "version": "3.3", 349 | "recipe": { 350 | "repo": "github.com/symfony/recipes", 351 | "branch": "master", 352 | "version": "3.3", 353 | "ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a" 354 | } 355 | }, 356 | "symfony/twig-bridge": { 357 | "version": "v4.1.7" 358 | }, 359 | "symfony/twig-bundle": { 360 | "version": "3.3", 361 | "recipe": { 362 | "repo": "github.com/symfony/recipes", 363 | "branch": "master", 364 | "version": "3.3", 365 | "ref": "369b5b29dc52b2c190002825ae7ec24ab6f962dd" 366 | } 367 | }, 368 | "symfony/validator": { 369 | "version": "4.1", 370 | "recipe": { 371 | "repo": "github.com/symfony/recipes", 372 | "branch": "master", 373 | "version": "4.1", 374 | "ref": "0cdc982334f45d554957a6167e030482795bf9d7" 375 | } 376 | }, 377 | "symfony/var-dumper": { 378 | "version": "v4.1.7" 379 | }, 380 | "symfony/web-link": { 381 | "version": "v4.1.7" 382 | }, 383 | "symfony/web-profiler-bundle": { 384 | "version": "3.3", 385 | "recipe": { 386 | "repo": "github.com/symfony/recipes", 387 | "branch": "master", 388 | "version": "3.3", 389 | "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6" 390 | } 391 | }, 392 | "symfony/web-server-bundle": { 393 | "version": "3.3", 394 | "recipe": { 395 | "repo": "github.com/symfony/recipes", 396 | "branch": "master", 397 | "version": "3.3", 398 | "ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a" 399 | } 400 | }, 401 | "symfony/yaml": { 402 | "version": "v4.1.7" 403 | }, 404 | "twig/twig": { 405 | "version": "v2.5.0" 406 | }, 407 | "webmozart/assert": { 408 | "version": "1.3.0" 409 | }, 410 | "zendframework/zend-code": { 411 | "version": "3.3.1" 412 | }, 413 | "zendframework/zend-eventmanager": { 414 | "version": "3.2.1" 415 | } 416 | } 417 | -------------------------------------------------------------------------------- /templates/base.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% block title %}Welcome!{% endblock %} 7 | 8 | 9 | {% block stylesheets %}{% endblock %} 10 | 11 | 12 | {% block body %}{% endblock %} 13 | {% block javascripts %}{% endblock %} 14 | 15 | -------------------------------------------------------------------------------- /templates/post/index.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Les articles !{% endblock %} 4 | 5 | {% block body %} 6 |
7 |

Nos articles

8 | {% if not is_granted('ROLE_USER') %} 9 | Connexion 10 | {% else %} 11 | Déconnexion 12 | {% endif %} 13 |
14 | {% for post in posts %} 15 |
16 |
17 |

{{post.title}}

18 |

{{post.introduction}}

19 | Lire la suite 20 |
21 |
22 | {% endfor %} 23 |
24 |
25 | {% endblock %} -------------------------------------------------------------------------------- /templates/security/login.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'base.html.twig' %} 2 | 3 | {% block title %}Connexion{% endblock %} 4 | 5 | {% block body %} 6 |
7 |

Connexion

8 | 9 |
10 |
11 | 12 | 13 |
14 |
15 | 16 | 17 |
18 |
19 | 20 | Retour 21 |
22 |
23 |
24 | {% endblock %} -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/tests/.gitignore -------------------------------------------------------------------------------- /translations/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liorchamla/cours-ajax/1f646c516e96b2f49ba45d6dec1af9dec8ac0c74/translations/.gitignore --------------------------------------------------------------------------------