Phalcon 开发工具(Phalcon Developer Tools)¶

Phalcon 开发工具(Phalcon Developer Tools)¶

使用脚手架生成 CRUD(Scaffold a 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.

Once the code is generated, it will have to be customized to meet your needs. Many developers avoid scaffolding entirely, opting

to write all or most of their source code from scratch. The generated code can serve as a guide to better understand of how the

framework works or develop prototypes. The screenshot below shows a scaffold based on the table “products”:

$ phalcon scaffold --table-name test

The scaffold generator will build several files in your application, along with some folders. Here’s a quick overview of what will be generated:

File

Purpose

app/controllers/ProductsController.php

The Products controller

app/models/Products.php

The Products model

app/views/layout/products.phtml

Controller layout for Products

app/views/products/new.phtml

View for the action “new”

app/views/products/edit.phtml

View for the action “edit”

app/views/products/search.phtml

View for the action “search”

app/views/products/edit.phtml

View for the action “edit”

When browsing the recently generated controller, you will see a search form and a link to create a new Product:

The “create page” allows you to create products applying validations on the Products model. Phalcon will automatically validate

not null fields producing warnings if any of them is required.

After performing a search, a pager component is available to show paged results. Use the “Edit” or “Delete” links in front of each result to perform such actions.

💡 相关推荐

国产版手办横评第三期,坐姿手办横评
称骨算命表 完整版图
365705

称骨算命表 完整版图

📅 07-05 👀 1650
中餐厅(乌云托月)开服时间表 2024新服时间一览