ダン・クァン・ミン Blog

はじめまして

CakePHP 3.x - Code Generation With Bake

Some useful command

$ bin/cake bake all users

$ bin/cake bake controller users

$ bin/cake bake model users

Full guide

When run with no arguments bin/cake bake will output a list of available tasks. You should see something like:

$ bin/cake bake

Welcome to CakePHP v3.0.0 Console
---------------------------------------------------------------
App : src
Path: /var/www/cakephp.dev/src/
---------------------------------------------------------------
The following commands can be used to generate skeleton code for your application.

Available bake commands:

- all
- behavior
- cell
- component
- controller
- fixture
- form
- helper
- model
- plugin
- shell
- template
- test

By using `cake bake [name]` you can invoke a specific bake task.

You can get more information on what each task does, and what options are available using the –help option:

$ bin/cake bake controller --help

Welcome to CakePHP v3.0.0 Console
---------------------------------------------------------------
App : src
Path: /var/www/cakephp.dev/src/
---------------------------------------------------------------
Bake a controller skeleton.

Usage:
cake bake controller [subcommand] [options] [<name>]

Subcommands:

all  Bake all controllers with CRUD methods.

To see help on a subcommand use `cake bake controller [subcommand] --help`

Options:

--help, -h        Display this help.
--verbose, -v     Enable verbose output.
--quiet, -q       Enable quiet output.
--plugin, -p      Plugin to bake into.
--force, -f       Force overwriting existing files without prompting.
--connection, -c  The datasource connection to get data from.
                  (default: default)
--theme, -t       The theme to use when baking code.
--components      The comma separated list of components to use.
--helpers         The comma separated list of helpers to use.
--prefix          The namespace/routing prefix to use.
--no-test         Do not generate a test skeleton.
--no-actions      Do not generate basic CRUD action methods.

Arguments:

name  Name of the controller to bake. Can use Plugin.name to bake
    controllers into plugins. (optional)

Comments