Improve base FileModel class

This commit is contained in:
Frederic Guillot
2016-05-28 20:44:19 -04:00
parent 9370797095
commit 14d6affe2e
3 changed files with 155 additions and 50 deletions

View File

@@ -11,30 +11,64 @@ namespace Kanboard\Model;
class ProjectFileModel extends FileModel
{
/**
* SQL table name
* Table name
*
* @var string
*/
const TABLE = 'project_has_files';
/**
* SQL foreign key
*
* @var string
*/
const FOREIGN_KEY = 'project_id';
/**
* Path prefix
*
* @var string
*/
const PATH_PREFIX = 'projects';
/**
* Events
*
* @var string
*/
const EVENT_CREATE = 'project.file.create';
/**
* Get the table
*
* @abstract
* @access protected
* @return string
*/
protected function getTable()
{
return self::TABLE;
}
/**
* Define the foreign key
*
* @abstract
* @access protected
* @return string
*/
protected function getForeignKey()
{
return 'project_id';
}
/**
* Define the path prefix
*
* @abstract
* @access protected
* @return string
*/
protected function getPathPrefix()
{
return 'projects';
}
/**
* Get event name
*
* @abstract
* @access protected
* @return string
*/
protected function getEventName()
{
return self::EVENT_CREATE;
}
}