./symfony list
语法:
symfony [选项] 任务名 [参数]选项:
–dry-run -n Do a dry run without executing actions.
–help -H 显示帮助信息
–quiet -q Do not log messages to standard output.
–trace -t Turn on invoke/execute tracing, enable full backtrace.
–version -V 显示程序版本
可用的任务:
help 显示任务的帮助信息 (简写h)list 列出任务
app:routes 显示一个应用程序当前的路由信息
cache:clear 清空缓存(简写cc, clear-cache)
configure:author 设置项目作者
configure:database 设置数据库 DSNgenerate:app 初始化一个应用程序 (简写init-app)
generate:module 初始化一个模块 (简写init-module)
generate:project 初始化一个项目 (简写init-proj)
generate:task Creates a skeleton class for a new taski18n:extract Extracts i18n strings from php files
i18n:find Finds non “i18n ready” strings in an applicationlog:clear 清空日志 (log-purge)
log:rotate Rotates an application log files (log-rotate)plugin:add-channel 添加一个新的PEAR频道
plugin:install 安装一个插件 (简写plugin-install)
plugin:list 列出已安装的插件 (简写plugin-list)
plugin:publish-assets 将全部插件的web目录发布到项目的web目录下
plugin:uninstall 卸载一个插件 (plugin-uninstall)
plugin:upgrade 升级一个插件(plugin-upgrade)project:clear-controllers Clears all non production environment controllers (clear-controllers)
project:deploy 发布一个项目到另外一台服务器 (sync)
project:disable 在指定环境下屏蔽一个应用程序 (disable)
project:enable 在指定环境下打开一个应用程序 (disable)
project:freeze 冻结 symfony 库文件 (简写freeze)
project:permissions 修改symfony项目目录的权限 (permissions, fix-perms)
project:unfreeze 解冻 symfony 库文件 (简写unfreeze)
project:upgrade1.1 将一个symfony项目升级到1.1
project:upgrade1.2 将一个symonfy项目从1.1升级到1.2propel:build-all 生成model,form,生成sql语句并创建数据库 (propel-build-all)
propel:build-all-load 生成model,form,生成sql语句,创建数据库并插入初始数据 (propel-build-all-load)
propel:build-filters 根据当前的模型创建过滤器
propel:build-forms 根据当前的模型创建表单
propel:build-model 根据数据库结构创建模型 (propel-build-model)
propel:build-schema 根据数据库结构创建schema (propel-build-schema)
propel:build-sql 根据当前模型创建一个SQL (简写propel-build-sql)
propel:data-dump 导出数据到 fixtures directory (propel-dump-data)
propel:data-load 从fixtures directory载入数据 (propel-load-data)
propel:generate-admin 自动生成一个module的后台
propel:generate-module Generates a Propel module (propel-generate-crud, propel:generate-crud)
propel:generate-module-for-route Generates a Propel module for a route definition
propel:graphviz Generates a graphviz chart of current object model
propel:init-admin 初始化一个module后台(propel-init-admin)
propel:insert-sql Inserts SQL for current model (propel-insert-sql)
propel:schema-to-xml 根据schema.yml生成schema.xml (propel-convert-yml-schema)
propel:schema-to-yml 根据schema.xml生成schema.yml (propel-convert-xml-schema)test:all 运行全部测试 (简写test-all)
test:coverage Outputs test code coverage
test:functional 运行全部功能测试 (简写test-functional)
test:unit 运行单元测试 (test-unit)
语法:
symfony app:routes application [name]参数:
application The application name
name A route name描述:
The app:routes displays the current routes for a given application:./symfony app:routes frontend
语法:
symfony cache:clear [--app[="..."]] [--env[="..."]] [--type[="..."]]别名: cc, clear-cache
选项:
–app The application name
–env The environment
–type The type (default: all)描述:
The cache:clear task clears the symfony cache.By default, it removes the cache for all available types, all applications,
and all environments.You can restrict by type, application, or environment:
For example, to clear the frontend application cache:
./symfony cache:clear –app=frontend
To clear the cache for the prod environment for the frontend application:
./symfony cache:clear –app=frontend –env=prod
To clear the cache for all prod environments:
./symfony cache:clear –env=prod
To clear the config cache for all prod environments:
./symfony cache:clear –type=config –env=prod
The built-in types are: config, i18n, routing, module
and template.
./symfony help configure:author
语法:
symfony configure:author author参数:
author The project author描述:
The configure:author task configures the author for a project:./symfony configure:author “Fabien Potencier <fabien.potencier@symfony-project.com>”
The author is used by the generates to pre-configure the PHPDoc header for each generated file.
The value is stored in [config/properties.ini].
./symfony help configure:database
语法:
symfony configure:database [--env[="..."]] [--name[="..."]] [--class[="..."]] [--app[="..."]] dsn [username] [password]参数:
dsn The database dsn
username The database username (default: root)
password The database password选项:
–env The environment (default: all)
–name The connection name (default: propel)
–class The database class name (default: sfPropelDatabase)
–app The application name描述:
The configure:database task configures the database DSN
for a project:./symfony configure:database mysql:host=localhost;dbname=example root mYsEcret
By default, the task change the configuration for all environment. If you want
to change the dsn for a specific environment, use the env option:./symfony configure:database –env=dev mysql:host=localhost;dbname=example_dev root mYsEcret
To change the configuration for a specific application, use the app option:
./symfony configure:database –app=frontend mysql:host=localhost;dbname=example root mYsEcret
You can also specify the connection name and the database class name:
./symfony configure:database –name=main –class=sfDoctrineDatabase mysql:host=localhost;dbname=example root
WARNING: The propel.ini file is also updated when you use a Propel database
and configure for all environments with no app.
语法:
symfony generate:app [--escaping-strategy="..."] [--csrf-secret="..."] application别名: init-app
参数:
application The application name选项:
–escaping-strategy Output escaping strategy (default: )
–csrf-secret Secret to use for CSRF protection (default: )描述:
The generate:app task creates the basic directory structure
for a new application in the current project:./symfony generate:app frontend
This task also creates two front controller scripts in the
web/ directory:web/%application%.php for the production environment
web/%application%_dev.php for the development environmentFor the first application, the production environment script is named
index.php.If an application with the same name already exists,
it throws a sfCommandException.You can enable output escaping (to prevent XSS) by using the escaping-strategy option:
./symfony generate:app frontend –escaping-strategy=on
You can enable session token in forms (to prevent CSRF) by defining
a secret with the csrf-secret option:./symfony generate:app frontend –csrf-secret=UniqueSecret
./symfony help generate:module
语法:
symfony generate:module application module别名: init-module
参数:
application The application name
module The module name描述:
The generate:module task creates the basic directory structure
for a new module in an existing application:./symfony generate:module frontend article
The task can also change the author name found in the actions.class.php
if you have configure it in config/properties.ini:[symfony]
name=blog
author=Fabien Potencier <fabien.potencier@sensio.com>You can customize the default skeleton used by the task by creating a
%sf_data_dir%/skeleton/module directory.The task also creates a functional test stub named
%sf_test_dir%/functional/%application%/%module%ActionsTest.class.php
that does not pass by default.If a module with the same name already exists in the application,
it throws a sfCommandException.
./symfony help generate:project
用方法:
symfony generate:project name别名: init-project
参数:
name The project name描述:
The generate:project task creates the basic directory structure
for a new project in the current directory:./symfony generate:project blog
If the current directory already contains a symfony project,
it throws a sfCommandException.
语法:
symfony generate:task [--dir="..."] [--use-database="..."] [--brief-description="..."] task_name参数:
task_name The task name (can contain namespace)选项:
–dir The directory to create the task in (default: lib/task)
–use-database Whether the task needs model initialization to access database (default: propel)
–brief-description A brief task description (appears in task list)描述:
The generate:task creates a new sfTask class based on the name passed as
argument:./symfony generate:task namespace:name
The namespaceNameTask.class.php skeleton task is created under the lib/task/
directory. Note that the namespace is optional.If you want to create the file in another directory (relative to the project
root folder), pass it in the –dir option. This directory will be created
if it does not already exist../symfony generate:task namespace:name –dir=plugins/myPlugin/lib/task
If you want the task to default to a connection other than propel, provide
the name of this connection with the –use-database option:./symfony generate:task namespace:name –use-database=main
The –use-database option can also be used to disable database
initialization in the generated task:./symfony generate:task namespace:name –use-database=false
You can also specify a description:
./symfony generate:task namespace:name –brief-description=”Does interesting things”
语法:
symfony i18n:extract [--display-new] [--display-old] [--auto-save] [--auto-delete] application culture参数:
application The application name
culture The target culture选项:
–display-new Output all new found strings
–display-old Output all old strings
–auto-save Save the new strings
–auto-delete Delete old strings描述:
The i18n:extract task extracts i18n strings from your project files
for the given application and target culture:./symfony i18n:extract frontend fr
By default, the task only displays the number of new and old strings
it found in the current project.If you want to display the new strings, use the –display-new option:
./symfony i18n:extract –display-new frontend fr
To save them in the i18n message catalogue, use the –auto-save option:
./symfony i18n:extract –auto-save frontend fr
If you want to display strings that are present in the i18n messages
catalogue but are not found in the application, use the
–display-old option:./symfony i18n:extract –display-old frontend fr
To automatically delete old strings, use the –auto-delete but
be careful, especially if you have translations for plugins as they will
appear as old strings but they are not:./symfony i18n:extract –auto-delete frontend fr
语法:
symfony i18n:find [--env="..."] application参数:
application The application name选项:
–env The environment (default: dev)描述:
The i18n:find task finds non internationalized strings embedded in templates:./symfony i18n:find frontend
This task is able to find non internationalized strings in pure HTML and in PHP code:
Non i18n text
As the task returns all strings embedded in PHP, you can have some false positive (especially
if you use the string syntax for helper arguments).
语法:
symfony log:clear别名: log-purge
描述:
The log:clear task clears all symfony log files:./symfony log:clear
语法:
symfony log:rotate [--history="..."] [--period="..."] application env别名: log-rotate
参数:
application The application name
env The environment name选项:
–history The maximum number of old log files to keep (default: 10)
–period The period in days (default: 7)描述:
The log:rotate task rotates application log files for a given
environment:./symfony log:rotate frontend dev
You can specify a period or a history option:
./symfony –history=10 –period=7 log:rotate frontend dev
./symfony help plugin:add-channel
语法:
symfony plugin:add-channel name参数:
name The channel name描述:
The plugin:add-channel task adds a new PEAR channel:./symfony plugin:add-channel symfony.plugins.pear.example.com
语法:
symfony plugin:install [--stability|-s="..."] [--release|-r="..."] [--channel|-c="..."] [--install_deps|-d] [--force-license] name别名: plugin-install
参数:
name The plugin name选项:
–stability (-s) The preferred stability (stable, beta, alpha)
–release (-r) The preferred version
–channel (-c) The PEAR channel name
–install_deps (-d) Whether to force installation of required dependencies
–force-license Whether to force installation even if the license is not MIT like描述:
The plugin:install task installs a plugin:./symfony plugin:install sfGuardPlugin
By default, it installs the latest stable release.
If you want to install a plugin that is not stable yet,
use the stability option:./symfony plugin:install –stability=beta sfGuardPlugin
./symfony plugin:install -s beta sfGuardPluginYou can also force the installation of a specific version:
./symfony plugin:install –release=1.0.0 sfGuardPlugin
./symfony plugin:install -r 1.0.0 sfGuardPluginTo force installation of all required dependencies, use the install_deps flag:
./symfony plugin:install –install-deps sfGuardPlugin
./symfony plugin:install -d sfGuardPluginBy default, the PEAR channel used is symfony-plugins
(plugins.symfony-project.org).You can specify another channel with the channel option:
./symfony plugin:install –channel=mypearchannel sfGuardPlugin
./symfony plugin:install -c mypearchannel sfGuardPluginOr you can use the channel/package notation:
./symfony plugin:install mypearchannel/sfGuardPlugin
You can also install PEAR packages hosted on a website:
./symfony plugin:install http://somewhere.example.com/sfGuardPlugin-1.0.0.tgz
Or local PEAR packages:
./symfony plugin:install /home/fabien/plugins/sfGuardPlugin-1.0.0.tgz
If the plugin contains some web content (images, stylesheets or javascripts),
the task creates a %name% symbolic link for those assets under web/.
On Windows, the task copy all the files to the web/%name% directory.
语法:
symfony plugin:list别名: plugin-list
描述:
The plugin:list task lists all installed plugins:./symfony plugin:list
It also gives the channel and version for each plugin.
./symfony help plugin:publish-assets
语法:
symfony plugin:publish-assets [--core-only] [--symfony-lib-dir="..."]选项:
–core-only If set only core plugins will publish their assets
–symfony-lib-dir The symfony lib dir描述:
The plugin:publish-assets task will publish web assets from all plugins../symfony plugin:publish-assets
In fact this will send the plugin.post_install event to each plugin.
./symfony help plugin:uninstall
语法:
symfony plugin:uninstall [--channel|-c="..."] [--install_deps|-d] name别名: plugin-uninstall
参数:
name The plugin name选项:
–channel (-c) The PEAR channel name
–install_deps (-d) Whether to force installation of dependencies描述:
The plugin:uninstall task uninstalls a plugin:./symfony plugin:uninstall sfGuardPlugin
The default channel is symfony.
You can also uninstall a plugin which has a different channel:
./symfony plugin:uninstall –channel=mypearchannel sfGuardPlugin
./symfony plugin:uninstall -c mypearchannel sfGuardPlugin
Or you can use the channel/package notation:
./symfony plugin:uninstall mypearchannel/sfGuardPlugin
You can get the PEAR channel name of a plugin by launching the
plugin:list] task.If the plugin contains some web content (images, stylesheets or javascripts),
the task also removes the [web/%name% symbolic link (on *nix)
or directory (on Windows).
语法:
symfony plugin:upgrade [--stability|-s="..."] [--release|-r="..."] [--channel|-c="..."] name别名: plugin-upgrade
参数:
name The plugin name选项:
–stability (-s) The preferred stability (stable, beta, alpha)
–release (-r) The preferred version
–channel (-c) The PEAR channel name描述:
The plugin:upgrade task tries to upgrade a plugin:./symfony plugin:upgrade sfGuardPlugin
The default channel is symfony.
If the plugin contains some web content (images, stylesheets or javascripts),
the task also updates the web/%name% directory content on Windows.See plugin:install for more information about the format of the plugin name and options.
./symfony help project:clear-controllers
语法:
symfony project:clear-controllers别名: clear-controllers
描述:
The project:clear-controllers task clears all non production environment
controllers:./symfony project:clear-controllers
You can use this task on a production server to remove all front
controller scripts except the production ones.If you have two applications named frontend and backend,
you have four default controller scripts in web/:index.php
frontend_dev.php
backend.php
backend_dev.phpAfter executing the project:clear-controllers task, two front
controller scripts are left in web/:index.php
backend.phpThose two controllers are safe because debug mode and the web debug
toolbar are disabled.
语法:
symfony project:deploy [--go] [--rsync-dir="..."] [--rsync-options[="..."]] server别名: sync
参数:
server The server name选项:
–go Do the deployment
–rsync-dir The directory where to look for rsync*.txt files (default: config)
–rsync-options To options to pass to the rsync executable (default: -azC –force –delete)描述:
The project:deploy task deploys a project on a server:./symfony project:deploy production
The server must be configured in config/properties.ini:
[production]
host=www.example.com
port=22
user=fabien
dir=/var/www/sfblog/
type=rsyncTo automate the deployment, the task uses rsync over SSH.
You must configure SSH access with a key or configure the password
in config/properties.ini.By default, the task is in dry-mode. To do a real deployment, you
must pass the –go option:./symfony project:deploy –go production
Files and directories configured in config/rsync_exclude.txt are
not deployed:.svn
/web/uploads/*
/cache/*
/log/*You can also create a rsync.txt and rsync_include.txt files.
If you need to customize the rsync*.txt files based on the server,
you can pass a rsync-dir option:./symfony project:deploy –go –rsync-dir=config/production production
Last, you can specify the options passed to the rsync executable, using the
rsync-options option (defaults are -azC):./symfony project:deploy –go –rsync-options=avz
./symfony help project:disable
语法:
symfony project:disable application env别名: disable
参数:
application The application name
env The environment name描述:
The project:disable task disables an application for a specific environment:./symfony project:disable frontend prod
语法:
symfony project:enable application env别名: enable
参数:
application The application name
env The environment name描述:
The project:enable task enables an application for a specific environment:./symfony project:enable frontend prod
语法:
symfony project:freeze symfony_data_dir别名: freeze
参数:
symfony_data_dir The symfony data directory描述:
The project:freeze task copies all the symfony core files to
the current project:./symfony project:freeze /path/to/symfony/data/directory
The task takes a mandatory argument of the path to the symfony data
directory.The task also changes config/config.php to switch to the
embedded symfony files.
./symfony help project:permissions
语法:
symfony project:permissions别名: permissions, fix-perms
描述:
The project:permissions task fixes directory permissions:./symfony project:permissions
./symfony help project:unfreeze
语法:
symfony project:unfreeze别名: unfreeze
描述:
The project:unfreeze task removes all the symfony core files from
the current project:./symfony project:unfreeze
The task also changes config/config.php to switch to the
old symfony files used before the project:freeze command was used.
./symfony help project:upgrade1.1
语法:
symfony project:upgrade1.1描述:
The project:upgrade1.1 task upgrades a symfony project
based the 1.0 release to the 1.1 symfony release../symfony project:upgrade1.1
Please read the UPGRADE_TO_1_1 file to have information on what does this task.
./symfony help project:upgrade1.2
语法:
symfony project:upgrade1.2描述:
The project:upgrade1.2 task upgrades a symfony project
based on the 1.1 release to the 1.2 symfony release../symfony project:upgrade1.2
Please read the UPGRADE_TO_1_2 file to have information on what does this task.
./symfony help propel:build-all
语法:
symfony propel:build-all [--application[="..."]] [--env="..."] [--connection="..."] [--no-confirmation] [--skip-forms|-F] [--classes-only|-C] [--phing-arg="..."]别名: propel-build-all
选项:
–application The application name (default: 1)
–env The environment (default: dev)
–connection The connection name (default: propel)
–no-confirmation Do not ask for confirmation
–skip-forms (-F) Skip generating forms
–classes-only (-C) Do not initialize the database
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:build-all task is a shortcut for five other tasks:./symfony propel:build-all
The task is equivalent to:
./symfony propel:build-model
./symfony propel:build-forms
./symfony propel:build-filters
./symfony propel:build-sql
./symfony propel:insert-sqlSee those tasks’ help pages for more information.
To bypass confirmation prompts, you can pass the no-confirmation option:
./symfony propel:buil-all –no-confirmation
To build all classes but skip initializing the database, use the classes-only
option:./symfony propel:build-all –classes-only
./symfony help propel:build-all-load
语法:
symfony propel:build-all-load [--application[="..."]] [--env="..."] [--connection="..."] [--no-confirmation] [--skip-forms|-F] [--classes-only|-C] [--phing-arg="..."] [--append] [--dir="..."]别名: propel-build-all-load
选项:
–application The application name (default: 1)
–env The environment (default: dev)
–connection The connection name (default: propel)
–no-confirmation Do not ask for confirmation
–skip-forms (-F) Skip generating forms
–classes-only (-C) Do not initialize the database
–phing-arg Arbitrary phing argument (multiple values allowed)
–append Don’t delete current data in the database
–dir The directories to look for fixtures (multiple values allowed)描述:
The propel:build-all-load task is a shortcut for two other tasks:./symfony propel:build-all-load
The task is equivalent to:
./symfony propel:build-all
./symfony propel:data-loadSee those tasks’ help pages for more information.
To bypass the confirmation, you can pass the no-confirmation
option:./symfony propel:buil-all-load –no-confirmation
./symfony help propel:build-filters
语法:
symfony propel:build-filters [--connection="..."] [--model-dir-name="..."] [--filter-dir-name="..."] [--application[="..."]]选项:
–connection The connection name (default: propel)
–model-dir-name The model dir name (default: model)
–filter-dir-name The filter form dir name (default: filter)
–application The application name (default: 1)描述:
The propel:build-filters task creates filter form classes from the schema:./symfony propel:build-filters
The task read the schema information in config/*schema.xml and/or
config/*schema.yml from the project and all installed plugins.The task use the propel connection as defined in config/databases.yml.
You can use another connection by using the –connection option:./symfony propel:build-filters –connection=”name”
The model filter form classes files are created in lib/filter.
This task never overrides custom classes in lib/filter.
It only replaces base classes generated in lib/filter/base.
./symfony help propel:build-forms
语法:
symfony propel:build-forms [--connection="..."] [--model-dir-name="..."] [--form-dir-name="..."] [--application[="..."]]选项:
–connection The connection name (default: propel)
–model-dir-name The model dir name (default: model)
–form-dir-name The form dir name (default: form)
–application The application name (default: 1)描述:
The propel:build-forms task creates form classes from the schema:./symfony propel:build-forms
The task read the schema information in config/*schema.xml and/or
config/*schema.yml from the project and all installed plugins.The task use the propel connection as defined in config/databases.yml.
You can use another connection by using the –connection option:./symfony propel:build-forms –connection=”name”
The model form classes files are created in lib/form.
This task never overrides custom classes in lib/form.
It only replaces base classes generated in lib/form/base.
./symfony help propel:build-model
语法:
symfony propel:build-model [--phing-arg="..."]别名: propel-build-model
选项:
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:build-model task creates model classes from the schema:./symfony propel:build-model
The task read the schema information in config/*schema.xml and/or
config/*schema.yml from the project and all installed plugins.You mix and match YML and XML schema files. The task will convert
YML ones to XML before calling the Propel task.The model classes files are created in lib/model.
This task never overrides custom classes in lib/model.
It only replaces files in lib/model/om and lib/model/map.
./symfony help propel:build-schema
语法:
symfony propel:build-schema [--application[="..."]] [--env="..."] [--connection="..."] [--xml] [--phing-arg="..."]别名: propel-build-schema
选项:
–application The application name (default: 1)
–env The environment (default: cli)
–connection The connection name
–xml Creates an XML schema instead of a YML one
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:build-schema task introspects a database to create a schema:./symfony propel:build-schema
By default, the task creates a YML file, but you can also create a XML file:
./symfony –xml propel:build-schema
The XML format contains more information than the YML one.
./symfony help propel:build-sql
语法:
symfony propel:build-sql [--phing-arg="..."]别名: propel-build-sql
选项:
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:build-sql task creates SQL statements for table creation:./symfony propel:build-sql
The generated SQL is optimized for the database configured in config/propel.ini:
propel.database = mysql
./symfony help propel:data-dump
语法:
symfony propel:data-dump [--application[="..."]] [--env="..."] [--connection="..."] [--classes="..."] [target]别名: propel-dump-data
参数:
target The target filename选项:
–application The application name (default: 1)
–env The environement (default: cli)
–connection The connection name (default: propel)
–classes The class names to dump (separated by a colon)描述:
The propel:data-dump task dumps database data:./symfony propel:data-dump > data/fixtures/dump.yml
By default, the task outputs the data to the standard output,
but you can also pass a filename as a second argument:./symfony propel:data-dump dump.yml
The task will dump data in data/fixtures/%target%
(data/fixtures/dump.yml in the example).The dump file is in the YML format and can be re-imported by using
the propel:data-dump task.By default, the task use the propel connection as defined in config/databases.yml.
You can use another connection by using the connection option:./symfony propel:data-dump –connection=”name”
If you only want to dump some classes, use the classes option:
./symfony propel:data-dump –classes=”Article,Category”
If you want to use a specific database configuration from an application, you can use
the application option:./symfony propel:data-dump –application=frontend
./symfony help propel:data-load
语法:
symfony propel:data-load [--application[="..."]] [--env="..."] [--append] [--connection="..."] [--dir="..."]别名: propel-load-data
选项:
–application The application name (default: 1)
–env The environment (default: cli)
–append Don’t delete current data in the database
–connection The connection name (default: propel)
–dir The directories to look for fixtures (multiple values allowed)描述:
The propel:data-load task loads data fixtures into the database:./symfony propel:data-load
The task loads data from all the files found in data/fixtures/.
If you want to load data from other directories, you can use
the –dir option:./symfony propel:data-load –dir=”data/fixtures” –dir=”data/data”
The task use the propel connection as defined in config/databases.yml.
You can use another connection by using the –connection option:./symfony propel:data-load –connection=”name”
If you don’t want the task to remove existing data in the database,
use the –append option:./symfony propel:data-load –append
If you want to use a specific database configuration from an application, you can use
the application option:./symfony propel:data-load –application=frontend
./symfony help propel:generate-admin
语法:
symfony propel:generate-admin [--module="..."] [--theme="..."] [--singular="..."] [--plural="..."] [--env="..."] application route_or_model参数:
application The application name
route_or_model The route name or the model class选项:
–module The module name
–theme The theme name (default: admin)
–singular The singular name
–plural The plural name
–env The environment (default: dev)描述:
The propel:generate-admin task generates a Propel admin module:./symfony propel:generate-admin frontend Article
The task creates a module in the %frontend% application for the
%Article% model.The task creates a route for you in the application routing.yml.
You can also generate a Propel admin module by passing a route name:
./symfony propel:generate-admin frontend article
The task creates a module in the %frontend% application for the
%article% route definition found in routing.yml.For the filters and batch actions to work properly, you need to add
the wildcard option to the route:article:
class: sfPropelRouteCollection
options:
model: Article
with_wildcard_routes: true
./symfony help propel:generate-module-for-route
语法:
symfony propel:generate-module-for-route [--theme="..."] [--non-verbose-templates] [--singular="..."] [--plural="..."] [--env="..."] application route参数:
application The application name
route The route name选项:
–theme The theme name (default: default)
–non-verbose-templates Generate non verbose templates
–singular The singular name
–plural The plural name
–env The environment (default: dev)描述:
The propel:generate-module-for-route task generates a Propel module for a route definition:./symfony propel:generate-module-for-route frontend article
The task creates a module in the %frontend% application for the
%article% route definition found in routing.yml.
./symfony help propel:graphviz
语法:
symfony propel:graphviz [--phing-arg="..."]选项:
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:graphviz task creates a graphviz DOT
visualization for automatic graph drawing of object model:./symfony propel:graphviz
./symfony help propel:init-admin
语法:
symfony propel:init-admin [--theme="..."] application module model别名: propel-init-admin
参数:
application The application name
module The module name
model The model class name选项:
–theme The theme name (default: default)描述:
The propel:init-admin task generates a Propel admin module:./symfony propel:init-admin frontend article Article
The task creates a %module% module in the %application% application
for the model class %model%.The created module is an empty one that inherit its actions and templates from
a runtime generated module in %sf_app_cache_dir%/modules/auto%module%.The generator can use a customized theme by using the –theme option:
./symfony propel:init-admin –theme=”custom” frontend article Article
./symfony help propel:insert-sql
语法:
symfony propel:insert-sql [--application[="..."]] [--env="..."] [--connection="..."] [--no-confirmation] [--phing-arg="..."]别名: propel-insert-sql
选项:
–application The application name (default: 1)
–env The environment (default: cli)
–connection The connection name
–no-confirmation Do not ask for confirmation
–phing-arg Arbitrary phing argument (multiple values allowed)描述:
The propel:insert-sql task creates database tables:./symfony propel:insert-sql
The task connects to the database and executes all SQL statements
found in config/sql/*schema.sql files.Before execution, the task will ask you to confirm the execution
as it deletes all data in your database.To bypass the confirmation, you can pass the –no-confirmation
option:./symfony propel:insert-sql –no-confirmation
The task read the database configuration from `databases.yml`.
You can use a specific application/environment by passing
an –application or –env option.You can also use the –connection option if you want to
only load SQL statements for a given connection.
./symfony help propel:schema-to-xml
语法:
symfony propel:schema-to-xml别名: propel-convert-yml-schema
描述:
The propel:schema-to-xml task converts YML schemas to XML:./symfony propel:schema-to-xml
./symfony help propel:schema-to-yml
语法:
symfony propel:schema-to-yml别名: propel-convert-xml-schema
描述:
The propel:schema-to-yml task converts XML schemas to YML:./symfony propel:schema-to-yml
语法:
symfony test:all别名: test-all
描述:
The test:all task launches all unit and functional tests:./symfony test:all
The task launches all tests found in test/.
If one or more test fail, you can try to fix the problem by launching
them by hand or with the test:unit and test:functional task.
语法:
symfony test:coverage [--detailed] test_name lib_name参数:
test_name A test file name or a test directory
lib_name A lib file name or a lib directory for wich you want to know the coverage选项:
–detailed Output detailed information描述:
The test:coverage task outputs the code coverage
given a test file or test directory
and a lib file or lib directory for which you want code
coverage:./symfony test:coverage test/unit/model lib/model
To output the lines not covered, pass the –detailed option:
./symfony test:coverage –detailed test/unit/model lib/model
./symfony help test:functional
./symfony help test:unit语法:
symfony test:functional application [controller1] … [nameN]别名: test-functional
参数:
application The application name
controller The controller name描述:
The test:functional task launches functional tests for a
given application:./symfony test:functional frontend
The task launches all tests found in test/functional/%application%.
You can launch all functional tests for a specific controller by
giving a controller name:./symfony test:functional frontend article
You can also launch all functional tests for several controllers:
./symfony test:functional frontend article comment
使用方法:
symfony test:unit [name1] … [nameN]别名: test-unit
参数:
name The test name描述:
The test:unit task launches unit tests:./symfony test:unit
The task launches all tests found in test/unit.
You can launch unit tests for a specific name:
./symfony test:unit strtolower
You can also launch unit tests for several names:
./symfony test:unit strtolower strtoupper
./symfony -V
symfony version 1.2.4-DEV (/home/maker/www/symfony/lib)

我操作命令 symfony propel:generate-module frontend entry AyEntries 以后。
报错如下:
Call to undefined method BaseAyEntries::toArray
能否指点一下如何解决?
Comment 由 jorn — 2009-06-04 @ 18:15
还真没遇难到这种情况 一般是 TOSTRING的
根据TOSTRING的经验来说, 是你的结构中定义了类似一对多或多对多的关系 (这个关系可能是正确的),导至你这个实体需要一个可以转成数组的函数供其它方法调用
你可以试一下,在对应位置 加一个TOARRAY函数 然后里面什么都不写,只扔出一个异常,对应的你就能找到调用的过程,进尔明白为什么会这样。
Comment 由 bobhero — 2009-06-05 @ 09:08
请确认你的Object对象是否有一个toArray方法,如果没有请添加。
Comment 由 maker — 2009-06-05 @ 09:11
添加了toArray()的方法以后, generate-module成功了, 但是页面上出现了Warning: array_merge(): Argument #1 is not an array in E:\htdocs\webroot\lib\symfony\plugins\sfPropelPlugin\lib\form\sfFormPropel.class.php on line 413 的错误。 看来, 这个是有参数的了。
Comment 由 jorn — 2009-06-05 @ 10:02
我的感觉是这样,你的object好像并不是通过symfony自动生成的,object中的toArray方法是propel在base类中自动生成的才对,你需要先定义schema.yml,然后通过propel:build-all命令来生成object。
Comment 由 maker — 2009-06-05 @ 10:12
是不是由于php的版本不及5.2.4的, 才会造成这样的结果? 我重新更改一下php版本试一下, 谢谢你的指点。
Comment 由 jorn — 2009-06-05 @ 10:23
你需要生成正确的object , php版本是会导致一些致命错误, 但应该不是你这个, 但也不排除由于版本或者库文件的原因导致object无法正常生成, 你这个问题明显是object对象内容错误, 使用propel生成object会在lib/model下生成一个object类,这个类继承自lib/model/om/下的BaseXXX类, 而BaseXXX类又继承自symfony的BaseObject这样, 查看BaseXXX类里会有很多set和get, toArray()也在其中, 我想你最好是参照jobeet教程进行一次操作。
Comment 由 maker — 2009-06-05 @ 10:32
嗯 , 好的, 麻烦你了。 :)
Comment 由 jorn — 2009-06-05 @ 10:46