Add Closure typehint to AdapterInterface::load()
This commit is contained in:
parent
32a9fbe35a
commit
cd9a43de7e
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace Tobyz\JsonApiServer\Adapter;
|
namespace Tobyz\JsonApiServer\Adapter;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use Tobyz\JsonApiServer\Context;
|
use Tobyz\JsonApiServer\Context;
|
||||||
use Tobyz\JsonApiServer\Schema\Attribute;
|
use Tobyz\JsonApiServer\Schema\Attribute;
|
||||||
use Tobyz\JsonApiServer\Schema\HasMany;
|
use Tobyz\JsonApiServer\Schema\HasMany;
|
||||||
|
|
@ -226,11 +227,11 @@ interface AdapterInterface
|
||||||
*
|
*
|
||||||
* @param array $models
|
* @param array $models
|
||||||
* @param array $relationships
|
* @param array $relationships
|
||||||
* @param mixed $scope Should be called to give the deepest relationship
|
* @param Closure $scope Should be called to give the deepest relationship
|
||||||
* an opportunity to scope the query that will fetch related resources
|
* an opportunity to scope the query that will fetch related resources
|
||||||
* @param bool $linkage true if we just need the IDs of the related
|
* @param bool $linkage true if we just need the IDs of the related
|
||||||
* resources and not their full data
|
* resources and not their full data
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function load(array $models, array $relationships, $scope, bool $linkage): void;
|
public function load(array $models, array $relationships, Closure $scope, bool $linkage): void;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ class EloquentAdapter implements AdapterInterface
|
||||||
$query->take($limit)->skip($offset);
|
$query->take($limit)->skip($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function load(array $models, array $relationships, $scope, bool $linkage): void
|
public function load(array $models, array $relationships, Closure $scope, bool $linkage): void
|
||||||
{
|
{
|
||||||
// TODO: Find the relation on the model that we're after. If it's a
|
// TODO: Find the relation on the model that we're after. If it's a
|
||||||
// belongs-to relation, and we only need linkage, then we won't need
|
// belongs-to relation, and we only need linkage, then we won't need
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue