diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-06-20 17:53:49 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-06-20 17:53:49 -0400 |
commit | 22b26d0b4d68f0492275ec93eb4df1a975a8fc80 (patch) | |
tree | a588fd826ce48ea6c7ce6f3da3259f8ea6204726 /app/Model/Comment.php | |
parent | b6b733b22f9e9f38786166c1274b135a99bce02a (diff) |
Change comments table structure (drop foreign key on user_id)
Diffstat (limited to 'app/Model/Comment.php')
-rw-r--r-- | app/Model/Comment.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/Model/Comment.php b/app/Model/Comment.php index 3aa9c027..e3ffc1be 100644 --- a/app/Model/Comment.php +++ b/app/Model/Comment.php @@ -42,7 +42,7 @@ class Comment extends Base ->table(self::TABLE) ->columns( self::TABLE.'.id', - self::TABLE.'.date', + self::TABLE.'.date_creation', self::TABLE.'.task_id', self::TABLE.'.user_id', self::TABLE.'.comment', @@ -51,7 +51,7 @@ class Comment extends Base User::TABLE.'.email' ) ->join(User::TABLE, 'id', 'user_id') - ->orderBy(self::TABLE.'.date', 'ASC') + ->orderBy(self::TABLE.'.date_creation', 'ASC') ->eq(self::TABLE.'.task_id', $task_id) ->findAll(); } @@ -71,7 +71,7 @@ class Comment extends Base self::TABLE.'.id', self::TABLE.'.task_id', self::TABLE.'.user_id', - self::TABLE.'.date', + self::TABLE.'.date_creation', self::TABLE.'.comment', User::TABLE.'.username', User::TABLE.'.name' @@ -105,7 +105,7 @@ class Comment extends Base */ public function create(array $values) { - $values['date'] = time(); + $values['date_creation'] = time(); $comment_id = $this->persist(self::TABLE, $values); if ($comment_id) { @@ -158,7 +158,6 @@ class Comment extends Base public function validateCreation(array $values) { $rules = array( - new Validators\Required('user_id', t('This value is required')), new Validators\Required('task_id', t('This value is required')), ); |