Skip to content

Commit

Permalink
Require guzzle, minor code enhancemants
Browse files Browse the repository at this point in the history
  • Loading branch information
bscheshirwork authored and SilverFire committed Jan 15, 2016
1 parent 4d29513 commit 55d33d9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
}
],
"require": {
"yiisoft/yii2": "~2.0"
"yiisoft/yii2": "~2.0",
"guzzlehttp/guzzle": "6.*"
},
"require-dev": {
"minii/db": "*@dev",
Expand Down
6 changes: 4 additions & 2 deletions src/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function one($db = null)

$result = $this->createCommand($db)->search(ArrayHelper::merge(['limit' => 1], $this->options));
if (empty($result)) {
return;
return null;
}
$result = reset($result);

Expand Down Expand Up @@ -427,7 +427,9 @@ public function getList($as_array = true, $db = null, $options = [])
}
$result = $models;
}
$result = $result ?: [];
if (empty($result)) {
$result = [];
}

// return $this->createCommand($db)->getList($options);
return $as_array ? ArrayHelper::map($result, 'gl_key', function ($o) {
Expand Down
6 changes: 3 additions & 3 deletions src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function isScenarioDefault()
public static function get($primaryKey = null, $options = [])
{
if ($primaryKey === null) {
return;
return null;
}
$command = static::getDb()->createCommand();
$result = $command->get(static::type(), $primaryKey, $options);
Expand All @@ -97,7 +97,7 @@ public static function get($primaryKey = null, $options = [])
return $model;
}

return;
return null;
}

/**
Expand Down Expand Up @@ -443,7 +443,7 @@ public function getIsNewRecord()
*/
public function optimisticLock()
{
return;
return null;
}

/**
Expand Down
24 changes: 1 addition & 23 deletions src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ class Query extends Component implements QueryInterface
use QueryTrait;

public $index;

public $type;

public $where;
public $_limit;
public $offset;
public $orderBy;
public $select;
public $join;

Expand Down Expand Up @@ -134,7 +128,7 @@ public function scalar($field, $db = null)
}
}

return;
return null;
}

public function column($field, $db = null)
Expand Down Expand Up @@ -255,20 +249,4 @@ public function timeout($timeout)

return $this;
}

/**
* @return mixed
*/
public function getLimit()
{
return $this->_limit;
}

/**
* @param mixed $limit
*/
public function setLimit($limit)
{
$this->_limit = $limit;
}
}

0 comments on commit 55d33d9

Please sign in to comment.