bluzphp /
framework
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Bluz Framework Component |
||
| 5 | * |
||
| 6 | * @copyright Bluz PHP Team |
||
| 7 | * @link https://github.com/bluzphp/framework |
||
| 8 | */ |
||
| 9 | |||
| 10 | declare(strict_types=1); |
||
| 11 | |||
| 12 | namespace Bluz\Crud; |
||
| 13 | |||
| 14 | use Bluz\Http\Exception\NotImplementedException; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Crud |
||
| 18 | * |
||
| 19 | * @package Bluz\Crud |
||
| 20 | * @author Anton Shevchuk |
||
| 21 | * @link https://github.com/bluzphp/framework/wiki/Crud |
||
| 22 | */ |
||
| 23 | interface CrudInterface |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Default limit for READ SET of elements |
||
| 27 | */ |
||
| 28 | public const DEFAULT_LIMIT = 10; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get item by primary key(s) |
||
| 32 | * |
||
| 33 | * @param mixed $primary |
||
| 34 | * |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | public function readOne($primary); |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get collection of items |
||
| 41 | * |
||
| 42 | * @param integer $offset |
||
| 43 | * @param integer $limit |
||
| 44 | * @param array $params |
||
| 45 | * |
||
| 46 | * @return array[Row[], integer] |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 47 | */ |
||
| 48 | public function readSet(int $offset = 0, int $limit = self::DEFAULT_LIMIT, array $params = []); |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Create new item |
||
| 52 | * |
||
| 53 | * @param array $data |
||
| 54 | * |
||
| 55 | * @return mixed |
||
| 56 | */ |
||
| 57 | public function createOne(array $data); |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Create items |
||
| 61 | * |
||
| 62 | * @param array $data |
||
| 63 | * |
||
| 64 | * @return mixed |
||
| 65 | */ |
||
| 66 | public function createSet(array $data); |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Update item |
||
| 70 | * |
||
| 71 | * @param mixed $primary |
||
| 72 | * @param array $data |
||
| 73 | * |
||
| 74 | * @return integer |
||
| 75 | */ |
||
| 76 | public function updateOne($primary, array $data); |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Update items |
||
| 80 | * |
||
| 81 | * @param array $data |
||
| 82 | * |
||
| 83 | * @return integer |
||
| 84 | */ |
||
| 85 | public function updateSet(array $data); |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Delete item |
||
| 89 | * |
||
| 90 | * @param mixed $primary |
||
| 91 | * |
||
| 92 | * @return integer |
||
| 93 | */ |
||
| 94 | public function deleteOne($primary); |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Delete items |
||
| 98 | * |
||
| 99 | * @param array $data |
||
| 100 | * |
||
| 101 | * @return integer |
||
| 102 | */ |
||
| 103 | public function deleteSet(array $data); |
||
| 104 | } |
||
| 105 |