Skip to content

Commit

Permalink
DANGEROUS change: Command::send returns response not data
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 31, 2017
1 parent 5cfe8b6 commit 7584eae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function batchPerform($action, $data = [], array $options = [])

public static function perform($action, $data = [], array $options = [])
{
return static::getDb()->createCommand()->perform($action, static::tableName(), $data, $options);
return static::getDb()->createCommand()->perform($action, static::tableName(), $data, $options)->getData();
}

/**
Expand Down
15 changes: 11 additions & 4 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function setRequest(RequestInterface $request)
* In API this could be get, search or list request.
* @param array $options send options
* @throws ResponseErrorException
* @return mixed response data
* @return ResponseInterface response object
*/
public function search($options = [])
{
Expand Down Expand Up @@ -77,6 +77,13 @@ public function update($table, $columns, $condition = [], array $params = [])
return $this->setRequest($request);
}

/**
* Sends a request to delete data.
* @param mixed $table entity to update
* @param array $condition
* @param array $params request parameters
* @return $this
*/
public function delete($table, $condition, array $params = [])
{
$request = $this->db->getQueryBuilder()->delete($table, $condition, $params);
Expand All @@ -90,7 +97,7 @@ public function delete($table, $condition, array $params = [])
* @param string $table
* @param mixed $body
* @param array $params request parameters
* @return mixed response data
* @return ResponseInterface response object
*/
public function perform($action, $table, $body = [], array $params = [])
{
Expand All @@ -103,7 +110,7 @@ public function perform($action, $table, $body = [], array $params = [])
/**
* Executes the request.
* @param array $options send options
* @return mixed response data
* @return ResponseInterface response object
*/
public function send($options = [])
{
Expand All @@ -114,7 +121,7 @@ public function send($options = [])
Yii::endProfile($profile, $category);
$this->db->checkResponse($response);

return $response->getData();
return $response;
}

public static function getProfileCategory()
Expand Down

0 comments on commit 7584eae

Please sign in to comment.