1 | <?php |
||
21 | abstract class CrudService extends Service |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * Actions classes map. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $_actionsClassMap = [ |
||
30 | 'describe' => '\CakeDC\Api\Service\Action\CrudDescribeAction', |
||
31 | 'index' => '\CakeDC\Api\Service\Action\CrudIndexAction', |
||
32 | 'view' => '\CakeDC\Api\Service\Action\CrudViewAction', |
||
33 | 'add' => '\CakeDC\Api\Service\Action\CrudAddAction', |
||
34 | 'edit' => '\CakeDC\Api\Service\Action\CrudEditAction', |
||
35 | 'delete' => '\CakeDC\Api\Service\Action\CrudDeleteAction', |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * Table name. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $_table = null; |
||
44 | |||
45 | /** |
||
46 | * Id param name. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $_idName = 'id'; |
||
51 | |||
52 | /** |
||
53 | * CrudService constructor. |
||
54 | * |
||
55 | * @param array $config Service configuration. |
||
56 | */ |
||
57 | 130 | public function __construct(array $config = []) |
|
66 | |||
67 | /** |
||
68 | * Gets a Table name. |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 113 | public function getTable() |
|
76 | |||
77 | /** |
||
78 | * Sets the table instance. |
||
79 | * |
||
80 | * @param string $table A Table name. |
||
81 | * @return $this |
||
82 | */ |
||
83 | 130 | public function setTable($table) |
|
89 | |||
90 | /** |
||
91 | * Api method for table. |
||
92 | * |
||
93 | * @param string $table A Table name. |
||
94 | * @deprecated 3.4.0 Use setTable()/getTable() instead. |
||
95 | * @return string |
||
96 | */ |
||
97 | public function table($table = null) |
||
110 | |||
111 | /** |
||
112 | * Action constructor options. |
||
113 | * |
||
114 | * @param array $route Activated route. |
||
115 | * @return array |
||
116 | */ |
||
117 | 55 | protected function _actionOptions($route) |
|
129 | } |
||
130 |