Skip to content

Commit

Permalink
Fix type issue at Model/Get
Browse files Browse the repository at this point in the history
  • Loading branch information
nohponex committed Jun 7, 2017
1 parent b71ed19 commit 83e148f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
16 changes: 16 additions & 0 deletions src/FilterAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,20 @@ public function __get($name)
$name
));
}

/**
* @param string $name
* @return mixed
*/
public function __isset($name)
{
switch ($name) {
case 'operand':
case 'operator':
case 'attribute':
return $this->attribute !== null;
default:
return false;
}
}
}
13 changes: 7 additions & 6 deletions src/Model/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ public static function getById($id, Fields $fields = null, ...$additionalParamet
}
}

/**
* @var string[]
*/
$idAsArray = is_array($id) ? $id : [$id];

//Prepare filter
$filter = new Filter((
is_array($id)
? $id
: [$id]
)); //Force array for primary data
$filter = new Filter($idAsArray); //Force array for primary data

$collection = static::get(
new Page(count($id)), //limit number of requested resources
new Page($idAsArray), //limit number of requested resources
$filter,
null, //sort
$fields, //fields
Expand Down

0 comments on commit 83e148f

Please sign in to comment.