-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ushi
committed
Apr 9, 2012
1 parent
23722b7
commit 5682c43
Showing
3 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* Part of Blogwurst | ||
* | ||
* @packacge Blogwurst | ||
* @version 1.0 | ||
* @license MIT | ||
*/ | ||
/** | ||
* Article model | ||
* | ||
* Handles the article data. | ||
*/ | ||
class Model_Article extends Orm\Model | ||
{ | ||
|
||
/** | ||
* Table name | ||
* | ||
* @var string The db table | ||
*/ | ||
protected static $_table_name = 'articles'; | ||
|
||
/** | ||
* Proeprties | ||
* | ||
* @var array The db table cols | ||
*/ | ||
protected static $_properties = array( | ||
'id' => array('data_type' => 'int'), | ||
'user_id' => array('data_type' => 'int'), | ||
'title' => array( | ||
'data_type' => 'varchar', | ||
'validation' => array('required'), | ||
), | ||
'slug' => array('data_type' => 'varchar'), | ||
'body' => array('data_type' => 'text'), | ||
'created_at' => array('data_type' => 'time_unix'), | ||
'updated_at' => array('data_type' => 'time_unix'), | ||
); | ||
|
||
/** | ||
* Belongs to | ||
* | ||
* @var array Belongs to relations | ||
*/ | ||
protected static $_belongs_to = array('user'); | ||
|
||
/** | ||
* Many many | ||
* | ||
* @var array Many many relations | ||
*/ | ||
protected static $_many_many = array('tags'); | ||
|
||
/** | ||
* Observers | ||
* | ||
* @var array Needed observers | ||
*/ | ||
protected static $_observers = array( | ||
'Orm\\Observer_Validation' => array( | ||
'events' => array('before_save'), | ||
), | ||
'Orm\\Observer_Typing' => array( | ||
'events' => array('before_save', 'after_save', 'after_load'), | ||
), | ||
'Orm\\Observer_Slug' => array( | ||
'events' => array('before_insert'), | ||
), | ||
'Orm\\Observer_CreatedAt' => array( | ||
'events' => array('before_insert'), | ||
), | ||
'Orm\\Observer_UpdatedAt' => array( | ||
'events' => array('before_save'), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Part of Blogwurst | ||
* | ||
* @packacge Blogwurst | ||
* @version 1.0 | ||
* @license MIT | ||
*/ | ||
/** | ||
* Tag model | ||
* | ||
* Handles the tag data. | ||
*/ | ||
class Model_Tag extends Orm\Model | ||
{ | ||
|
||
/** | ||
* Table name | ||
* | ||
* @var string The db table | ||
*/ | ||
protected static $_table_name = 'tags'; | ||
|
||
/** | ||
* Proeprties | ||
* | ||
* @var array The db table cols | ||
*/ | ||
protected static $_properties = array( | ||
'id' => array('data_type' => 'int'), | ||
'tag' => array('data_type' => 'varchar'), | ||
'slug' => array('data_type' => 'varchar'), | ||
); | ||
|
||
/** | ||
* Many many | ||
* | ||
* @var array Many many relations | ||
*/ | ||
protected static $_many_many = array('articles'); | ||
|
||
/** | ||
* Observers | ||
* | ||
* @var array Needed observers | ||
*/ | ||
protected static $_observers = array( | ||
'Orm\\Observer_Typing' => array( | ||
'events' => array('before_save', 'after_save', 'after_load'), | ||
), | ||
'Orm\\Observer_Slug' => array( | ||
'events' => array('before_insert'), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
|
||
<?php | ||
/** | ||
* Part of Blogwurst | ||
* | ||
* @packacge Blogwurst | ||
* @version 1.0 | ||
* @license MIT | ||
*/ | ||
/** | ||
* User model | ||
* | ||
* Handles the user data. | ||
*/ | ||
class Model_User extends Orm\Model | ||
{ | ||
|
||
/** | ||
* Table name | ||
* | ||
* @var string The db table | ||
*/ | ||
protected static $_table_name = 'users'; | ||
|
||
/** | ||
* Proeprties | ||
* | ||
* @var array The db table cols | ||
*/ | ||
protected static $_properties = array( | ||
'id' => array('data_type' => 'int'), | ||
'username' => array('data_type' => 'varchar'), | ||
'password' => array('data_type' => 'varchar'), | ||
'group' => array('data_type' => 'int'), | ||
'email' => array('data_type' => 'varchar'), | ||
'last_login' => array('data_type' => 'varchar'), | ||
'login_hash' => array('data_type' => 'varchar'), | ||
'profile_fields' => array('data_type' => 'serialize'), | ||
'reset_hash' => array('data_type' => 'varchar'), | ||
'created_at' => array('data_type' => 'time_unix'), | ||
); | ||
|
||
/** | ||
* Has many | ||
* | ||
* @var array Has many relations | ||
*/ | ||
protected static $_has_many = array('articles'); | ||
|
||
/** | ||
* Observers | ||
* | ||
* @var array Needed observers | ||
*/ | ||
protected static $_observers = array( | ||
'Orm\\Observer_Typing' => array( | ||
'events' => array('before_save', 'after_save', 'after_load'), | ||
), | ||
); | ||
} |