summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/GettingStarted/CommandLine.page
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-01-12 23:45:18 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-08-23 12:37:52 +0200
commit1d729693961dfa4cf4da45a05d703b392dbcb47f (patch)
tree5efb37a9da9f80822dd350f99da7a4a0116b4537 /demos/quickstart/protected/pages/GettingStarted/CommandLine.page
parent1144e49b8e00fa75b1593e4637c9218d7d944b97 (diff)
Quickstart Doc overhaul, pt. 2: active controls + minor fixes
Diffstat (limited to 'demos/quickstart/protected/pages/GettingStarted/CommandLine.page')
-rwxr-xr-xdemos/quickstart/protected/pages/GettingStarted/CommandLine.page35
1 files changed, 34 insertions, 1 deletions
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 <b>leave out the semicolon</b> to show the results.
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70010">
>> $db->queryPostByID(1)
</com:TTextHighlighter>
-There should not be any errors and you should see the following.
+There should not be any errors and you should see the following.
<com:TTextHighlighter Language="cli" CssClass="source block-content cli" id="code_70011">
PostRecord#1
(
@@ -109,4 +109,37 @@ PostRecord#1
)
</com:TTextHighlighter>
</p>
+<<<<<<< HEAD
+=======
+
+<h2>Creating Active Record Classes</h2>
+<p>
+In the blog demo project, we need to create two <a href="?page=Database.ActiveRecord">Active Record</a> classes, <tt>UserRecord</tt> and <tt>PostRecord</tt>, to represent data records in the <tt>users</tt> and <tt>posts</tt> tables, respectively. Active Record classes must extend from the base class <tt>ActiveRecord</tt>, and must define property names that matches with the field names of the corresponding table.
+</p>
+
+<p>
+To better organize our directories, we create a new directory <tt>protected/database</tt> to hold the class files. We also modify our application configuration by inserting the following lines. It is equivalent to adding the directory <tt>protected/database</tt> to PHP include_path, which allows us to use the classes without explicitly including them.
+</p>
+
+<com:TTextHighlighter CssClass="source" Language="xml">
+<paths>
+ <using namespace="Application.database.*" />
+</paths>
+</com:TTextHighlighter>
+
+<p>
+At the prompt, enter the following two commands to create <tt>UserRecord</tt> and <tt>PostRecord</tt> classes:
+</p>
+
+<com:TTextHighlighter CssClass="source cli" Language="text">
+>> generate users Application.database.UserRecord
+
+>> generate posts Application.database.PostRecord
+</com:TTextHighlighter>
+
+<p>
+Here we used the <a href="?page=Fundamentals.Components1">namespace format</a> again to specify the classes to be created. The path <tt>Application.database.UserRecord</tt> indicates that we want the <tt>UserRecord</tt> class file to be <tt>protected/database/UserRecord.php</tt>.
+</p>
+
+>>>>>>> ef81c44... Quickstart Doc overhaul, pt. 2: active controls + minor fixes
</com:TContent>