From 104100cccd4e7b30ec84ed055fb78745dd94b5b0 Mon Sep 17 00:00:00 2001 From: mikl <> Date: Thu, 16 Oct 2008 08:46:57 +0000 Subject: Ticket #891 (new static method table() in TActiveRecord) --- .../quickstart/protected/pages/Database/ActiveRecord.page | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'demos/quickstart/protected/pages') 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, TABLE = "`database1`.`table1`". +
Note: +Since version 3.1.3 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. + +class TeamRecord extends TActiveRecord +{ + public static function table() { + return 'Teams'; + } +} + +
+

Since TActiveRecord extends TComponent, setter and getter methods can be defined to allow control over how variables @@ -1183,4 +1196,4 @@ instead of $userRecord->first_name. This helps separation of logic and -

$Id$
\ No newline at end of file +
$Id$
-- cgit v1.2.3