wip
This commit is contained in:
parent
0d43544adc
commit
545277e425
|
|
@ -132,12 +132,18 @@ trait SavesData
|
||||||
|
|
||||||
$value = &$data[$field->location][$name];
|
$value = &$data[$field->location][$name];
|
||||||
|
|
||||||
if ($field instanceof Schema\HasOne) {
|
if ($field instanceof Schema\Relationship) {
|
||||||
$value = $this->getModelForIdentifier($request, $value['data']);
|
$value = $value['data'];
|
||||||
} elseif ($field instanceof Schema\HasMany) {
|
|
||||||
$value = array_map(function ($identifier) use ($request) {
|
if ($value) {
|
||||||
return $this->getModelForIdentifier($request, $identifier);
|
if ($field instanceof Schema\HasOne) {
|
||||||
}, $value['data']);
|
$value = $this->getModelForIdentifier($request, $value);
|
||||||
|
} elseif ($field instanceof Schema\HasMany) {
|
||||||
|
$value = array_map(function ($identifier) use ($request) {
|
||||||
|
return $this->getModelForIdentifier($request, $identifier);
|
||||||
|
}, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class Index implements RequestHandlerInterface
|
||||||
$paginationLinks[] = new Link\PrevLink($this->buildUrl($request, $params));
|
$paginationLinks[] = new Link\PrevLink($this->buildUrl($request, $params));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($schema->countable) {
|
if ($schema->countable && $schema->paginate) {
|
||||||
$total = $adapter->count($query);
|
$total = $adapter->count($query);
|
||||||
|
|
||||||
$members[] = new Meta('total', $total);
|
$members[] = new Meta('total', $total);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue