Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| TaskSeenMapper | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package Modules\Tasks\Models |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace Modules\Tasks\Models; |
| 16 | |
| 17 | use Modules\Admin\Models\AccountMapper; |
| 18 | use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; |
| 19 | |
| 20 | /** |
| 21 | * Task seen mapper class. |
| 22 | * |
| 23 | * This class is used to mark a task as seen. Additionally, you may set a reminder flag which can be used to highlight |
| 24 | * a task. |
| 25 | * |
| 26 | * @package Modules\Tasks\Models |
| 27 | * @license OMS License 2.0 |
| 28 | * @link https://jingga.app |
| 29 | * @since 1.0.0 |
| 30 | * |
| 31 | * @template T of TaskSeen |
| 32 | * @extends DataMapperFactory<T> |
| 33 | */ |
| 34 | final class TaskSeenMapper extends DataMapperFactory |
| 35 | { |
| 36 | /** |
| 37 | * Columns. |
| 38 | * |
| 39 | * @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}> |
| 40 | * @since 1.0.0 |
| 41 | */ |
| 42 | public const COLUMNS = [ |
| 43 | 'task_seen_id' => ['name' => 'task_seen_id', 'type' => 'int', 'internal' => 'id'], |
| 44 | 'task_seen_at' => ['name' => 'task_seen_at', 'type' => 'DateTime', 'internal' => 'seenAt'], |
| 45 | 'task_seen_task' => ['name' => 'task_seen_task', 'type' => 'int', 'internal' => 'task'], |
| 46 | 'task_seen_by' => ['name' => 'task_seen_by', 'type' => 'int', 'internal' => 'seenBy'], |
| 47 | 'task_seen_reminder' => ['name' => 'task_seen_reminder', 'type' => 'bool', 'internal' => 'isRemindered'], |
| 48 | 'task_seen_reminder_at' => ['name' => 'task_seen_reminder_at', 'type' => 'DateTime', 'internal' => 'reminderAt'], |
| 49 | 'task_seen_reminder_by' => ['name' => 'task_seen_reminder_by', 'type' => 'int', 'internal' => 'reminderBy'], |
| 50 | ]; |
| 51 | |
| 52 | /** |
| 53 | * Belongs to. |
| 54 | * |
| 55 | * @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}> |
| 56 | * @since 1.0.0 |
| 57 | */ |
| 58 | public const BELONGS_TO = [ |
| 59 | 'reminderBy' => [ |
| 60 | 'mapper' => AccountMapper::class, |
| 61 | 'external' => 'task_seen_reminder_by', |
| 62 | ], |
| 63 | ]; |
| 64 | |
| 65 | /** |
| 66 | * Primary table. |
| 67 | * |
| 68 | * @var string |
| 69 | * @since 1.0.0 |
| 70 | */ |
| 71 | public const TABLE = 'task_seen'; |
| 72 | |
| 73 | /** |
| 74 | * Primary field name. |
| 75 | * |
| 76 | * @var string |
| 77 | * @since 1.0.0 |
| 78 | */ |
| 79 | public const PRIMARYFIELD = 'task_seen_id'; |
| 80 | } |