1 | <?php |
||
18 | class Command extends \yii\base\Component |
||
19 | { |
||
20 | /** |
||
21 | * @var AbstractConnection |
||
22 | */ |
||
23 | public $db; |
||
24 | |||
25 | /** |
||
26 | * @var RequestInterface request object |
||
27 | */ |
||
28 | protected $request; |
||
29 | |||
30 | 2 | public function setRequest(RequestInterface $request) |
|
36 | |||
37 | /** |
||
38 | * Sends a request to retrieve data. |
||
39 | * In API this could be get, search or list request. |
||
40 | * @param array $options send options |
||
41 | * @throws ResponseErrorException |
||
42 | * @return ResponseInterface response object |
||
43 | */ |
||
44 | 2 | public function search($options = []) |
|
50 | |||
51 | /** |
||
52 | * Sends a request to create/insert data. |
||
53 | * @param mixed $table entity to create |
||
54 | * @param mixed $columns attributes of object to create |
||
55 | * @param array $params request parameters |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function insert($table, $columns, array $params = []) |
||
59 | { |
||
60 | $request = $this->db->getQueryBuilder()->insert($table, $columns, $params); |
||
61 | |||
62 | return $this->setRequest($request); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Sends a request to update data. |
||
67 | * @param mixed $table entity to update |
||
68 | * @param mixed $columns attributes of object to update |
||
69 | * @param array $condition |
||
70 | * @param array $params request parameters |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function update($table, $columns, $condition = [], array $params = []) |
||
79 | |||
80 | /** |
||
81 | * Sends a request to delete data. |
||
82 | * @param mixed $table entity to update |
||
83 | * @param array $condition |
||
84 | * @param array $params request parameters |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function delete($table, $condition, array $params = []) |
||
93 | |||
94 | /** |
||
95 | * Creates and executes request with given data. |
||
96 | * @param string $action |
||
97 | * @param string $table |
||
98 | * @param mixed $body |
||
99 | * @param array $params request parameters |
||
100 | * @return ResponseInterface response object |
||
101 | */ |
||
102 | public function perform($action, $table, $body = [], array $params = []) |
||
109 | |||
110 | /** |
||
111 | * Executes the request. |
||
112 | * @param array $options send options |
||
113 | * @return ResponseInterface response object |
||
114 | */ |
||
115 | 2 | public function send($options = []) |
|
126 | |||
127 | 2 | public static function getProfileCategory() |
|
131 | } |
||
132 |