-
Notifications
You must be signed in to change notification settings - Fork 0
Developer
The developer
module plugin, bundled with Pair_example, allows you to create a new module including an ActiveRecord class, the full set of MVC files with all HTML layouts for a complete CRUD functionality starting from a database table.
The construction of a new module starts by creating a database table. Let’s create a sample table named persons
. Look the following example:
Field | Type | Length | Unsigned | Nullable | Key | Default | Extra |
---|---|---|---|---|---|---|---|
id | int | 11 | √ | PRI | auto_increment | ||
name | varchar | 100 | |||||
birthday | datetime | ||||||
sex | enum | 'Male','Female' | √ | NULL | |||
height | decimal | 5,2 | √ | NULL | |||
married | tinyint | 1 |
When done, press the Start button in the Developer
module default view.
This list shows all the tables not linked to any ActiveRecord class of your web project.
Selecting the creation of only the Class or the whole module starts the wizard.
This is an example of creating a module. On the page above you can choose the name of the module, the name of the single object, which will correspond to a row in the associated table, and two other options.
This list shows how the columns of the table are interpreted by Pair when a new module is created thru the wizard:
MySQL column type | Pair default cast | PHP type |
---|---|---|
bool boolean tinyint(1) smallint(1) mediumint(1) int(1) |
bool | bool |
tinyint(>1) smallint(>1) mediumint(>1) int(>1) year |
int | int |
dec decimal double double precision fixed float numeric real |
float | float |
date | date | DateTime |
datetime timestamp |
datetime | DateTime |
char varchar text enum json bigint time |
string | string |
set | csv | array:string |