diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-28 20:44:19 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-28 20:44:19 -0400 |
commit | 14d6affe2e42fc86a86fbe5e624dbaacf6b8223c (patch) | |
tree | 2349e97550af64f4df05a490244d2702862967cf /app/Model/TaskFileModel.php | |
parent | 937079709514c037959d691c0d653c39d5ea84e6 (diff) |
Improve base FileModel class
Diffstat (limited to 'app/Model/TaskFileModel.php')
-rw-r--r-- | app/Model/TaskFileModel.php | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/app/Model/TaskFileModel.php b/app/Model/TaskFileModel.php index 21d319b0..24c1ad4b 100644 --- a/app/Model/TaskFileModel.php +++ b/app/Model/TaskFileModel.php @@ -11,32 +11,66 @@ namespace Kanboard\Model; class TaskFileModel extends FileModel { /** - * SQL table name + * Table name * * @var string */ const TABLE = 'task_has_files'; /** - * SQL foreign key + * Events * * @var string */ - const FOREIGN_KEY = 'task_id'; + const EVENT_CREATE = 'task.file.create'; /** - * Path prefix + * Get the table * - * @var string + * @abstract + * @access protected + * @return string */ - const PATH_PREFIX = 'tasks'; + protected function getTable() + { + return self::TABLE; + } /** - * Events + * Define the foreign key * - * @var string + * @abstract + * @access protected + * @return string */ - const EVENT_CREATE = 'task.file.create'; + protected function getForeignKey() + { + return 'task_id'; + } + + /** + * Define the path prefix + * + * @abstract + * @access protected + * @return string + */ + protected function getPathPrefix() + { + return 'tasks'; + } + + /** + * Get event name + * + * @abstract + * @access protected + * @return string + */ + protected function getEventName() + { + return self::EVENT_CREATE; + } /** * Handle screenshot upload |