Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
prog:symfony:controleurs:make_controller [11/09/2022 19:26] thierry [Problèmes] |
prog:symfony:controleurs:make_controller [11/09/2022 19:45] (Version actuelle) thierry [Commande] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Console de Symfony : make:controller ====== | + | ====== Créer un Controleur ====== |
+ | ====== Prérequis ====== | ||
+ | * ''symfony/maker-bundle'' doit être installé (sinon voir section **Problème** ci-dessous) | ||
===== Commande ===== | ===== Commande ===== | ||
- | La commande ''symfony console make:controller %NomDuController%'' créé la base d'un nouveau [[:controlles|controller]] dans la structure du projet Symfony. | + | La commande ''symfony console make:controller %NomDuController%'' créé la base d'un nouveau controller dans la structure du projet Symfony. |
<code shell> | <code shell> | ||
Ligne 18: | Ligne 21: | ||
Next: Open your new controller class and add some pages! | Next: Open your new controller class and add some pages! | ||
- | </code> | ||
- | ===== Problèmes ===== | ||
- | Si la commande ''symfony console make:controller'' ne fonctionne pas c'est peut etre parce que le bundle ''maker-bundle'' n'est pas installé, dans ce cas il faut l'installer avec la commande : ''composer require symfony/maker-bundle --dev'' | ||
- | <code> | ||
- | >composer require symfony/maker-bundle --dev | ||
- | Info from https://repo.packagist.org: | ||
- | Cannot use symfony/maker-bundle's latest version v1.45.0 as it requires php >=8.0 which is not satisfied by your platform. | ||
- | Using version ^1.43 for symfony/maker-bundle | ||
- | ./composer.json has been updated | ||
- | Running composer update symfony/maker-bundle | ||
- | Loading composer repositories with package information | ||
- | Updating dependencies | ||
- | Lock file operations: 3 installs, 0 updates, 0 removals | ||
- | - Locking doctrine/inflector (2.0.5) | ||
- | - Locking nikic/php-parser (v4.15.1) | ||
- | - Locking symfony/maker-bundle (v1.43.0) | ||
- | Writing lock file | ||
- | Installing dependencies from lock file (including require-dev) | ||
- | Package operations: 3 installs, 0 updates, 0 removals | ||
- | - Downloading nikic/php-parser (v4.15.1) | ||
- | - Downloading doctrine/inflector (2.0.5) | ||
- | - Installing nikic/php-parser (v4.15.1): Extracting archive | ||
- | - Installing doctrine/inflector (2.0.5): Extracting archive | ||
- | - Installing symfony/maker-bundle (v1.43.0): Extracting archive | ||
- | Generating optimized autoload files | ||
- | 38 packages you are using are looking for funding. | ||
- | Use the `composer fund` command to find out more! | ||
- | |||
- | Symfony operations: 1 recipe (7f92de602bee2d9edd782e4cc4d1bd2a) | ||
- | - Configuring symfony/maker-bundle (>=1.0): From github.com/symfony/recipes:main | ||
- | Executing script cache:clear [OK] | ||
- | Executing script assets:install public [OK] | ||
- | |||
- | What's next? | ||
- | |||
- | |||
- | Some files have been created and/or updated to configure your new packages. | ||
- | Please review, edit and commit them: these files are yours. | ||
- | |||
- | No security vulnerability advisories found | ||
</code> | </code> | ||
+ | <note important>Si la commande ''symfony console make:controller %NomDuController%'' ne fonctionne pas, voir le paragraphe **Problèmes**, ci dessous</note> | ||
===== Résultat ===== | ===== Résultat ===== | ||
Ligne 113: | Ligne 77: | ||
{% endblock %}</file> | {% endblock %}</file> | ||
==== Résultat dans un navigateur ==== | ==== Résultat dans un navigateur ==== | ||
- | ''http://obi103/html/xxx/yyy/public/index.php/test'' | ||
{{::hellotestcontroller.jpg}} | {{::hellotestcontroller.jpg}} | ||
+ | |||
+ | ===== Problèmes ===== | ||
+ | Si la commande ''symfony console make:controller'' ne fonctionne pas c'est peut etre parce que le bundle ''maker-bundle'' n'est pas installé, dans ce cas il faut l'installer avec les commande : | ||
+ | - ''composer require symfony/maker-bundle --dev'' | ||
+ | - ''composer require doctrine/annotations'' | ||
+ | <code> | ||
+ | >composer require symfony/maker-bundle --dev | ||
+ | Info from https://repo.packagist.org: | ||
+ | Cannot use symfony/maker-bundle's latest version v1.45.0 as it requires php >=8.0 which is not satisfied by your platform. | ||
+ | Using version ^1.43 for symfony/maker-bundle | ||
+ | ./composer.json has been updated | ||
+ | Running composer update symfony/maker-bundle | ||
+ | Loading composer repositories with package information | ||
+ | Updating dependencies | ||
+ | Lock file operations: 3 installs, 0 updates, 0 removals | ||
+ | - Locking doctrine/inflector (2.0.5) | ||
+ | - Locking nikic/php-parser (v4.15.1) | ||
+ | - Locking symfony/maker-bundle (v1.43.0) | ||
+ | Writing lock file | ||
+ | Installing dependencies from lock file (including require-dev) | ||
+ | Package operations: 3 installs, 0 updates, 0 removals | ||
+ | - Downloading nikic/php-parser (v4.15.1) | ||
+ | - Downloading doctrine/inflector (2.0.5) | ||
+ | - Installing nikic/php-parser (v4.15.1): Extracting archive | ||
+ | - Installing doctrine/inflector (2.0.5): Extracting archive | ||
+ | - Installing symfony/maker-bundle (v1.43.0): Extracting archive | ||
+ | Generating optimized autoload files | ||
+ | 38 packages you are using are looking for funding. | ||
+ | Use the `composer fund` command to find out more! | ||
+ | |||
+ | Symfony operations: 1 recipe (7f92de602bee2d9edd782e4cc4d1bd2a) | ||
+ | - Configuring symfony/maker-bundle (>=1.0): From github.com/symfony/recipes:main | ||
+ | Executing script cache:clear [OK] | ||
+ | Executing script assets:install public [OK] | ||
+ | |||
+ | What's next? | ||
+ | |||
+ | |||
+ | Some files have been created and/or updated to configure your new packages. | ||
+ | Please review, edit and commit them: these files are yours. | ||
+ | |||
+ | No security vulnerability advisories found | ||
+ | </code> | ||
+ | <code> | ||
+ | >composer require doctrine/annotations | ||
+ | Using version ^1.13 for doctrine/annotations | ||
+ | ./composer.json has been updated | ||
+ | Running composer update doctrine/annotations | ||
+ | Loading composer repositories with package information | ||
+ | Updating dependencies | ||
+ | Lock file operations: 2 installs, 0 updates, 0 removals | ||
+ | - Locking doctrine/annotations (1.13.3) | ||
+ | - Locking doctrine/lexer (1.2.3) | ||
+ | Writing lock file | ||
+ | Installing dependencies from lock file (including require-dev) | ||
+ | Package operations: 2 installs, 0 updates, 0 removals | ||
+ | - Installing doctrine/lexer (1.2.3): Extracting archive | ||
+ | - Installing doctrine/annotations (1.13.3): Extracting archive | ||
+ | Generating optimized autoload files | ||
+ | 39 packages you are using are looking for funding. | ||
+ | Use the `composer fund` command to find out more! | ||
+ | |||
+ | Symfony operations: 1 recipe (0beb45a1df42235ccf408079cf154a9d) | ||
+ | - Configuring doctrine/annotations (>=1.0): From github.com/symfony/recipes:main | ||
+ | Executing script cache:clear [OK] | ||
+ | Executing script assets:install public [OK] | ||
+ | |||
+ | What's next? | ||
+ | |||
+ | |||
+ | Some files have been created and/or updated to configure your new packages. | ||
+ | Please review, edit and commit them: these files are yours. | ||
+ | |||
+ | No security vulnerability advisories found | ||
+ | </code> | ||
+ | |||
+ | |||