From d5bf61ef97d3ce5ccd157653fc675b4156a0ad50 Mon Sep 17 00:00:00 2001 From: Larry Li Date: Thu, 29 Nov 2012 17:03:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Invo=20=E9=94=99=E5=88=AB=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh/reference/tutorial-invo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh/reference/tutorial-invo.rst b/zh/reference/tutorial-invo.rst index 5fc3cd838166..7d712d80de03 100644 --- a/zh/reference/tutorial-invo.rst +++ b/zh/reference/tutorial-invo.rst @@ -36,7 +36,7 @@ INVO应用程序分为两部分,即通常我们说的前台后台。前台部 标准路由器 --------------- -INVO使用标准的内奸路由器组件,此路由的匹配模式如下 /:controller/:action/:params ,这意味着,URL中的第一部分是控制器,第二个是action方法。 +INVO使用标准的内建路由器组件,此路由的匹配模式如下 /:controller/:action/:params ,这意味着,URL中的第一部分是控制器,第二个是action方法。 路由 /session/register 将要执行SessionController中的RegisterAction方法 From 12351525f8ce1634c5e9d63223a7b205b5ca0398 Mon Sep 17 00:00:00 2001 From: Larry Li Date: Thu, 29 Nov 2012 17:59:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BF=BB=E8=AF=91=20tools=20=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E5=B7=A5=E5=85=B7=E9=83=A8=E5=88=86=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh/reference/tools.rst | 96 +++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/zh/reference/tools.rst b/zh/reference/tools.rst index 809e09adc588..0fba1cb01d68 100755 --- a/zh/reference/tools.rst +++ b/zh/reference/tools.rst @@ -1,19 +1,17 @@ -Phalcon Developer Tools -======================= -These tools are a collection of useful scripts to generate skeleton code. Core components of your application can be generated with -a simple command, allowing you to easily develop applications using Phalcon. +Phalcon 开发工具 +================ +开发工具是生成脚手架代码的一系列脚本。使用简单的命令生成应用的核心代码,使得 Phalcon 开发过程更加容易。 .. highlights:: - **Important:** Phalcon Framework version 0.5.0 or greater is needed to use developer tools. It is highly recommended - to use PHP 5.3.6 or greater. If you prefer to use the web version instead of the console, this `blog post`_ offers more information. + **重要提醒:** Phalcon 框架 0.5.0 或以上版本需要使用本开发工具。强烈建议使用 PHP 5.3.6 或更高版本。如果你不需要命令行脚本而习惯网页工具,请参阅该`博客`_。 -Download --------- -You can download or clone a cross platform package containing the developer tools from Github_. +下载 +---- +可以从 Github_ 下载或克隆跨平台的开发工具包。 -Installation -^^^^^^^^^^^^ -These are detailed instructions on how to install the developer tools on different platforms: +安装 +^^^^ +不同平台下开发工具的详细安装说明如下: .. toctree:: :maxdepth: 1 @@ -22,45 +20,43 @@ These are detailed instructions on how to install the developer tools on differe mactools linuxtools -Getting Available Commands --------------------------- -You can get a list of available commands in Phalcon tools by typing: phalcon commands +显示可用的命令 +-------------- +输入 phalcon commands 可以显示一个可用的命令列表: .. figure:: ../_static/img/tools-4.png :align: center -Generating a Project Skeleton ------------------------------ -You can use Phalcon tools to generate pre-defined project skeletons for your applications with Phalcon framework. By default the -project skeleton generator will use mod_rewrite for Apache. Type the following command on your web server document root: +生成项目脚手架 +-------------- +使用 Phalcon 工具可以自动生成一个为 Phalcon 框架预先编写好的项目脚手架。默认情况下,项目脚手架生成器会使用 Apache mod_rewrite 模块。在 Web 服务器文档根目录下输入下列命令: .. figure:: ../_static/img/tools-1.png :align: center -The above recommended project structure was generated: +生成的项目目录结构如下: .. figure:: ../_static/img/tools-2.png :align: center -You could add the parameter *--help* to get help on the usage of a certain script: +使用 *--help* 命令参数查看命令帮助: .. figure:: ../_static/img/tools-3.png :align: center -Accessing the project from the web server will show you: +在浏览器中访问该项目显示如下: .. figure:: ../_static/img/tools-6.png :align: center -Generating Controllers ----------------------- -The command "create-controller" generates controller skeleton structures. It's important to invoke this command inside a directory -that already has a Phalcon project. +生成控制器 +---------- +命令 "create-controller" 生成控制器脚手架。需要注意的是,必须在一个 Phalcon 项目目录下使用该命令。 .. figure:: ../_static/img/tools-5.png :align: center -The following code is generated by the script: +脚本会生成下面的代码: .. code-block:: php @@ -76,12 +72,11 @@ The following code is generated by the script: } -Preparing Database Settings ---------------------------- -When a project is generated using developer tools. A configuration file can be found in *app/config/config.ini* To generate models -or scaffold, you will need to change the settings used to connect to your database. +数据库预配置 +------------ +开发工具生成项目时,也会自动创建 *app/config/config.ini* 配置文件。在使用开发工具生成模型和 CURD 增删改查脚手架前,必须更改数据库的设置以便正确连接到数据库。 -Change the database section in your config.ini file: +更改 config.ini 文件的数据库部分: .. code-block:: ini @@ -98,15 +93,14 @@ Change the database section in your config.ini file: viewsDir = "../app/views/" baseUri = "/store/" -Generating Models ------------------ -There are several ways to create models. You can create all models from the default database connection or some selectively. Models -can have public attributes for the field representations or setters/getters can be used. The simplest way to generate a model is: +生成模型 +-------- +创建模型有好几种方法。可以从默认的数据库连接创建所有模型,也可以有选择性的创建。每一个表字段可以声明为模型的 public 属性,也可以使用 setters/getters 来操作。最简单的生成模型方法如下: .. figure:: ../_static/img/tools-7.png :align: center -All table fields are declared public for direct access. +所有的表字段都被声明为可供直接访问的 public 属性。 .. code-block:: php @@ -147,8 +141,7 @@ All table fields are declared public for direct access. } -By adding the *--get-set* you can generate the fields with protected variables and public setter/getter methods. Those methods -can help in business logic implementation within the setter/getter methods. +使用 *--get-set* 参数可以将表字段声明为 protected,同时生成 public setter/getter 方法。在业务逻辑中使用相应的 setter/getter 方法。 .. code-block:: php @@ -219,16 +212,15 @@ can help in business logic implementation within the setter/getter methods. } -A nice feature of the model generator is that it keeps changes made by the developer between code generations. This allows the -addition or removal of fields and properties, without worrying about losing changes made to the model itself. -The following screencast shows you how it works: +模型生成器的好处在于开发者能使用生成器来控制变更。生成器增加或删除字段和属性,而不用担心忘记更改模型的内容。 +详细的工作原理可以参阅下面的视频演示: .. raw:: html
-Scaffold a CRUD ---------------- +生成 CRUD 增删改查脚手架 +------------------------ Scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job. @@ -275,27 +267,27 @@ After performing a search, a pager component is available to show paged results. .. figure:: ../_static/img/tools-12.png :align: center -Web Interface to Tools ----------------------- +Web 界面工具 +------------- Also, if you prefer, it's possible to use Phalcon Developer Tools from a web interface. Check out the following screencast to figure out how it works: .. raw:: html
-Integrating Tools with PhpStorm IDE ------------------------------------ +PhpStorm IDE 内置工具 +--------------------- The screencast below shows how to integrate developer tools with the `PhpStorm IDE`_. The configuration steps could be easily adapted to other IDEs for PHP. .. raw:: html
-Conclusion ----------- -Phalcon Developer Tools provides an easy way to generate code for your application, reducing development time and potential coding errors. +结论 +----- +Phalcon 开发工具提供简单的方式生成应用代码,减少开发时间并降低潜在的编码错误风险。 -.. _blog post: http://blog.phalconphp.com/post/23251010409/dont-like-command-line-and-consoles-no-problem +.. _博客: http://blog.phalconphp.com/post/23251010409/dont-like-command-line-and-consoles-no-problem .. _Github: https://github.com/phalcon/phalcon-devtools .. _Bootstrap: http://twitter.github.com/bootstrap/ .. _PhpStorm IDE: http://www.jetbrains.com/phpstorm/ \ No newline at end of file