diff options
author | emkael <emkael@tlen.pl> | 2016-03-15 22:06:47 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-03-15 22:06:47 +0100 |
commit | cc09e963e8ef7ea093c7b13096856e5c732cd776 (patch) | |
tree | 9da36344800f23ed05b00df914e2b9c71e86ccee /app/php/model | |
parent | 6dcabb240f0ff0ee1654ac66f806bedb22495d23 (diff) |
* extending TActiveRecord so it's capable of fetching mapped column fields from sql maps
Diffstat (limited to 'app/php/model')
-rw-r--r-- | app/php/model/Calendar.php | 11 | ||||
-rw-r--r-- | app/php/model/Category.php | 7 | ||||
-rw-r--r-- | app/php/model/Entry.php | 7 | ||||
-rw-r--r-- | app/php/model/User.php | 3 | ||||
-rw-r--r-- | app/php/model/UserPreference.php | 4 |
5 files changed, 19 insertions, 13 deletions
diff --git a/app/php/model/Calendar.php b/app/php/model/Calendar.php index 4438572..9e1afce 100644 --- a/app/php/model/Calendar.php +++ b/app/php/model/Calendar.php @@ -1,12 +1,13 @@ <?php +Prado::using('Application.db.ActiveRecord'); Prado::using('Application.model.Entry'); Prado::using('Application.model.Category'); -class Calendar extends TActiveRecord { +class Calendar extends ActiveRecord { const TABLE = 'calendars'; - + public $UID; public $Url; public $Name; @@ -23,18 +24,18 @@ class Calendar extends TActiveRecord { 'website' => 'Website', 'visible' => 'Visible', 'last_updated' => 'LastUpdated', - '_category' => 'CategoryID' + '_category' => 'CategoryID' ]; public static $RELATIONS = [ 'Entries' => [self::HAS_MANY, 'Entry', '_calendar'], 'Category' => [self::BELONGS_TO, 'Category', '_category'] ]; - + public static function finder($className=__CLASS__) { return parent::finder($className); } - + } ?> diff --git a/app/php/model/Category.php b/app/php/model/Category.php index 03a368a..5e71e53 100644 --- a/app/php/model/Category.php +++ b/app/php/model/Category.php @@ -1,8 +1,9 @@ <?php +Prado::using('Application.db.ActiveRecord'); Prado::using('Application.model.Calendar'); -class Category extends TActiveRecord { +class Category extends ActiveRecord { const TABLE = 'categories'; @@ -17,11 +18,11 @@ class Category extends TActiveRecord { public static $RELATIONS = [ 'Calendars' => [self::HAS_MANY, 'Calendar', '_category'] ]; - + public static function finder($className=__CLASS__) { return parent::finder($className); } - + } ?> diff --git a/app/php/model/Entry.php b/app/php/model/Entry.php index 85d522f..3106e8e 100644 --- a/app/php/model/Entry.php +++ b/app/php/model/Entry.php @@ -1,8 +1,9 @@ <?php +Prado::using('Application.db.ActiveRecord'); Prado::using('Application.model.Calendar'); -class Entry extends TActiveRecord { +class Entry extends ActiveRecord { const TABLE = 'entries'; @@ -30,11 +31,11 @@ class Entry extends TActiveRecord { public static $RELATIONS = [ 'Calendar' => [self::BELONGS_TO, 'Calendar', '_calendar'] ]; - + public static function finder($className=__CLASS__) { return parent::finder($className); } - + } ?> diff --git a/app/php/model/User.php b/app/php/model/User.php index b31b926..baa9912 100644 --- a/app/php/model/User.php +++ b/app/php/model/User.php @@ -1,8 +1,9 @@ <?php +Prado::using('Application.db.ActiveRecord'); Prado::using('Application.model.Calendar'); -class User extends TActiveRecord { +class User extends ActiveRecord { const TABLE = 'users'; diff --git a/app/php/model/UserPreference.php b/app/php/model/UserPreference.php index ff32529..90fa221 100644 --- a/app/php/model/UserPreference.php +++ b/app/php/model/UserPreference.php @@ -1,6 +1,8 @@ <?php -class UserPreference extends TActiveRecord { +Prado::using('Application.db.ActiveRecord'); + +class UserPreference extends ActiveRecord { const TABLE = 'user_selections'; |