From 1d729693961dfa4cf4da45a05d703b392dbcb47f Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 12 Jan 2014 23:45:18 +0100 Subject: Quickstart Doc overhaul, pt. 2: active controls + minor fixes --- .../pages/GettingStarted/CommandLine.page | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'demos/quickstart/protected/pages/GettingStarted/CommandLine.page') diff --git a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page index cee05130..6f56cd72 100755 --- a/demos/quickstart/protected/pages/GettingStarted/CommandLine.page +++ b/demos/quickstart/protected/pages/GettingStarted/CommandLine.page @@ -91,7 +91,7 @@ we leave out the semicolon to show the results. >> $db->queryPostByID(1) -There should not be any errors and you should see the following. +There should not be any errors and you should see the following. PostRecord#1 ( @@ -109,4 +109,37 @@ PostRecord#1 )

+<<<<<<< HEAD +======= + +

Creating Active Record Classes

+

+In the blog demo project, we need to create two Active Record classes, UserRecord and PostRecord, to represent data records in the users and posts tables, respectively. Active Record classes must extend from the base class ActiveRecord, and must define property names that matches with the field names of the corresponding table. +

+ +

+To better organize our directories, we create a new directory protected/database to hold the class files. We also modify our application configuration by inserting the following lines. It is equivalent to adding the directory protected/database to PHP include_path, which allows us to use the classes without explicitly including them. +

+ + + + + + + +

+At the prompt, enter the following two commands to create UserRecord and PostRecord classes: +

+ + +>> generate users Application.database.UserRecord + +>> generate posts Application.database.PostRecord + + +

+Here we used the namespace format again to specify the classes to be created. The path Application.database.UserRecord indicates that we want the UserRecord class file to be protected/database/UserRecord.php. +

+ +>>>>>>> ef81c44... Quickstart Doc overhaul, pt. 2: active controls + minor fixes -- cgit v1.2.3