summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Database
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/pages/Database')
-rw-r--r--demos/quickstart/protected/pages/Database/ActiveRecord.page15
1 files changed, 14 insertions, 1 deletions
diff --git a/demos/quickstart/protected/pages/Database/ActiveRecord.page b/demos/quickstart/protected/pages/Database/ActiveRecord.page
index 70998587..d54290ab 100644
--- a/demos/quickstart/protected/pages/Database/ActiveRecord.page
+++ b/demos/quickstart/protected/pages/Database/ActiveRecord.page
@@ -129,6 +129,19 @@ class UserRecord extends TActiveRecord
You may specify qualified table names. E.g. for MySQL, <tt>TABLE = "`database1`.`table1`"</tt>.
</div>
+<div class="note"><b class="note">Note:</b>
+Since version <b>3.1.3</b> you can also use a static method to define the table name.
+This allows you to dynamically specify which table should be used by the ActiveRecord.
+<com:TTextHighlighter Language="php" CssClass="source block-content">
+class TeamRecord extends TActiveRecord
+{
+ public static function table() {
+ return 'Teams';
+ }
+}
+</com:TTextHighlighter>
+</div>
+
<p class="block-content" id="ar_as_component">
Since <tt>TActiveRecord</tt> extends <tt>TComponent</tt>, setter and
getter methods can be defined to allow control over how variables
@@ -1183,4 +1196,4 @@ instead of <tt>$userRecord->first_name</tt>. This helps separation of logic and
</ul>
-<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
+<div class="last-modified">$Id$</div></com:TContent>