Re-format mappers

This commit is contained in:
Dennis Eichhorn 2018-05-31 19:47:26 +02:00
parent 57ff8f3727
commit 518e290e37
2 changed files with 37 additions and 37 deletions

View File

@ -39,7 +39,7 @@ class TaskElementMapper extends DataMapperAbstract
protected static $columns = [ protected static $columns = [
'task_element_id' => ['name' => 'task_element_id', 'type' => 'int', 'internal' => 'id'], 'task_element_id' => ['name' => 'task_element_id', 'type' => 'int', 'internal' => 'id'],
'task_element_desc' => ['name' => 'task_element_desc', 'type' => 'string', 'internal' => 'description'], 'task_element_desc' => ['name' => 'task_element_desc', 'type' => 'string', 'internal' => 'description'],
'task_element_desc_raw' => ['name' => 'task_element_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'task_element_desc_raw' => ['name' => 'task_element_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'task_element_status' => ['name' => 'task_element_status', 'type' => 'int', 'internal' => 'status'], 'task_element_status' => ['name' => 'task_element_status', 'type' => 'int', 'internal' => 'status'],
'task_element_due' => ['name' => 'task_element_due', 'type' => 'DateTime', 'internal' => 'due'], 'task_element_due' => ['name' => 'task_element_due', 'type' => 'DateTime', 'internal' => 'due'],
'task_element_forwarded' => ['name' => 'task_element_forwarded', 'type' => 'int', 'internal' => 'forwarded'], 'task_element_forwarded' => ['name' => 'task_element_forwarded', 'type' => 'int', 'internal' => 'forwarded'],
@ -56,10 +56,10 @@ class TaskElementMapper extends DataMapperAbstract
*/ */
protected static $hasMany = [ protected static $hasMany = [
'media' => [ 'media' => [
'mapper' => MediaMapper::class, 'mapper' => MediaMapper::class,
'table' => 'task_element_media', 'table' => 'task_element_media',
'dst' => 'task_element_media_src', 'dst' => 'task_element_media_src',
'src' => 'task_element_media_dst', 'src' => 'task_element_media_dst',
], ],
]; ];

View File

@ -41,18 +41,18 @@ class TaskMapper extends DataMapperAbstract
* @since 1.0.0 * @since 1.0.0
*/ */
protected static $columns = [ protected static $columns = [
'task_id' => ['name' => 'task_id', 'type' => 'int', 'internal' => 'id'], 'task_id' => ['name' => 'task_id', 'type' => 'int', 'internal' => 'id'],
'task_title' => ['name' => 'task_title', 'type' => 'string', 'internal' => 'title'], 'task_title' => ['name' => 'task_title', 'type' => 'string', 'internal' => 'title'],
'task_desc' => ['name' => 'task_desc', 'type' => 'string', 'internal' => 'description'], 'task_desc' => ['name' => 'task_desc', 'type' => 'string', 'internal' => 'description'],
'task_desc_raw' => ['name' => 'task_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'task_desc_raw' => ['name' => 'task_desc_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'task_type' => ['name' => 'task_type', 'type' => 'int', 'internal' => 'type'], 'task_type' => ['name' => 'task_type', 'type' => 'int', 'internal' => 'type'],
'task_status' => ['name' => 'task_status', 'type' => 'int', 'internal' => 'status'], 'task_status' => ['name' => 'task_status', 'type' => 'int', 'internal' => 'status'],
'task_closable' => ['name' => 'task_closable', 'type' => 'bool', 'internal' => 'isClosable'], 'task_closable' => ['name' => 'task_closable', 'type' => 'bool', 'internal' => 'isClosable'],
'task_priority' => ['name' => 'task_priority', 'type' => 'int', 'internal' => 'priority'], 'task_priority' => ['name' => 'task_priority', 'type' => 'int', 'internal' => 'priority'],
'task_due' => ['name' => 'task_due', 'type' => 'DateTime', 'internal' => 'due'], 'task_due' => ['name' => 'task_due', 'type' => 'DateTime', 'internal' => 'due'],
'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'], 'task_done' => ['name' => 'task_done', 'type' => 'DateTime', 'internal' => 'done'],
'task_schedule' => ['name' => 'task_schedule', 'type' => 'int', 'internal' => 'schedule'], 'task_schedule' => ['name' => 'task_schedule', 'type' => 'int', 'internal' => 'schedule'],
'task_start' => ['name' => 'task_start', 'type' => 'DateTime', 'internal' => 'start'], 'task_start' => ['name' => 'task_start', 'type' => 'DateTime', 'internal' => 'start'],
'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy'], 'task_created_by' => ['name' => 'task_created_by', 'type' => 'int', 'internal' => 'createdBy'],
'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], 'task_created_at' => ['name' => 'task_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
]; ];
@ -65,22 +65,22 @@ class TaskMapper extends DataMapperAbstract
*/ */
protected static $hasMany = [ protected static $hasMany = [
'taskElements' => [ 'taskElements' => [
'mapper' => TaskElementMapper::class, 'mapper' => TaskElementMapper::class,
'table' => 'task_element', 'table' => 'task_element',
'dst' => 'task_element_task', 'dst' => 'task_element_task',
'src' => null, 'src' => null,
], ],
'media' => [ // todo: maybe make this a has one and then link to collection instead of single media files! 'media' => [
'mapper' => MediaMapper::class, 'mapper' => MediaMapper::class,
'table' => 'task_media', 'table' => 'task_media',
'dst' => 'task_media_src', 'dst' => 'task_media_src',
'src' => 'task_media_dst', 'src' => 'task_media_dst',
], ],
'acc' => [ // todo: maybe make this a has one and then link to collection instead of single media files! 'acc' => [
'mapper' => AccountMapper::class, 'mapper' => AccountMapper::class,
'table' => 'task_account', 'table' => 'task_account',
'dst' => 'task_account_account', 'dst' => 'task_account_account',
'src' => 'task_account_task', 'src' => 'task_account_task',
], ],
]; ];
@ -99,8 +99,8 @@ class TaskMapper extends DataMapperAbstract
*/ */
protected static $ownsOne = [ protected static $ownsOne = [
'schedule' => [ 'schedule' => [
'mapper' => ScheduleMapper::class, 'mapper' => ScheduleMapper::class,
'src' => 'task_schedule', 'src' => 'task_schedule',
], ],
]; ];
@ -144,10 +144,10 @@ class TaskMapper extends DataMapperAbstract
$query = new Builder(self::$db); $query = new Builder(self::$db);
$query->prefix(self::$db->getPrefix()) $query->prefix(self::$db->getPrefix())
->count() ->count()
->from(self::$table) ->from(self::$table)
->where(self::$table . '.task_created_by', '=', $user) ->where(self::$table . '.task_created_by', '=', $user)
->where(self::$table . '.task_status', '=', TaskStatus::OPEN, 'and'); ->where(self::$table . '.task_status', '=', TaskStatus::OPEN, 'and');
$sth = self::$db->con->prepare($query->toSql()); $sth = self::$db->con->prepare($query->toSql());
$sth->execute(); $sth->execute();