diff options
author | mikl <> | 2008-10-16 08:46:57 +0000 |
---|---|---|
committer | mikl <> | 2008-10-16 08:46:57 +0000 |
commit | 104100cccd4e7b30ec84ed055fb78745dd94b5b0 (patch) | |
tree | 3d4cef9ed43053dd7d0a861ec32119523ee10e75 /demos/quickstart/protected | |
parent | 710a1d43a1ff0f5449529a13d9a93676fbfb3f5d (diff) |
Ticket #891 (new static method table() in TActiveRecord)
Diffstat (limited to 'demos/quickstart/protected')
-rw-r--r-- | demos/quickstart/protected/pages/Database/ActiveRecord.page | 15 |
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> |