Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package phpOMS\DataStorage |
| 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 phpOMS\DataStorage; |
| 16 | |
| 17 | /** |
| 18 | * Datamapper interface. |
| 19 | * |
| 20 | * This interface is used for DB, Cache & Session implementations |
| 21 | * |
| 22 | * @package phpOMS\DataStorage |
| 23 | * @license OMS License 2.0 |
| 24 | * @link https://jingga.app |
| 25 | * @since 1.0.0 |
| 26 | */ |
| 27 | interface DataMapperInterface |
| 28 | { |
| 29 | /** |
| 30 | * Create data. |
| 31 | * |
| 32 | * @param mixed $obj Object reference (gets filled with insert id) |
| 33 | * |
| 34 | * @return mixed |
| 35 | * |
| 36 | * @since 1.0.0 |
| 37 | */ |
| 38 | public static function create(mixed $obj); |
| 39 | |
| 40 | /** |
| 41 | * Update data. |
| 42 | * |
| 43 | * @param mixed $obj Object reference (gets filled with insert id) |
| 44 | * |
| 45 | * @return mixed |
| 46 | * |
| 47 | * @since 1.0.0 |
| 48 | */ |
| 49 | public static function update(mixed $obj); |
| 50 | |
| 51 | /** |
| 52 | * Delete data. |
| 53 | * |
| 54 | * @param mixed $obj Object to delete |
| 55 | * |
| 56 | * @return int Status |
| 57 | * |
| 58 | * @since 1.0.0 |
| 59 | */ |
| 60 | public static function delete(mixed $obj); |
| 61 | |
| 62 | /** |
| 63 | * Find data. |
| 64 | * |
| 65 | * @param string $search Search |
| 66 | * |
| 67 | * @return array |
| 68 | * |
| 69 | * @since 1.0.0 |
| 70 | */ |
| 71 | public static function find(string $search) : array; |
| 72 | |
| 73 | /** |
| 74 | * Get object. |
| 75 | * |
| 76 | * @param mixed $primaryKey Key |
| 77 | * |
| 78 | * @return self |
| 79 | * |
| 80 | * @since 1.0.0 |
| 81 | */ |
| 82 | public static function get(mixed $primaryKey); |
| 83 | } |