Fix up Show endpoint callbacks

This commit is contained in:
Toby Zerner 2021-05-05 14:15:19 +09:30
parent 1e1fc4cdb3
commit 8029c6fd4a
2 changed files with 4 additions and 2 deletions

View File

@ -38,11 +38,13 @@ class Show
public function handle(Context $context): ResponseInterface public function handle(Context $context): ResponseInterface
{ {
run_callbacks($this->resource->getSchema()->getListeners('showing'), [&$this->model, $context]);
$include = $this->getInclude($context); $include = $this->getInclude($context);
$this->loadRelationships([$this->model], $include, $context); $this->loadRelationships([$this->model], $include, $context);
run_callbacks($this->resource->getSchema()->getListeners('show'), [&$this->model, $context]); run_callbacks($this->resource->getSchema()->getListeners('shown'), [&$this->model, $context]);
$serializer = new Serializer($this->api, $context); $serializer = new Serializer($this->api, $context);
$serializer->add($this->resource, $this->model, $include); $serializer->add($this->resource, $this->model, $include);

View File

@ -220,7 +220,7 @@ final class Type
} }
/** /**
* Run a callback when a resource is shown. * Run a callback after a resource is shown.
*/ */
public function onShown(callable $callback): void public function onShown(callable $callback): void
{ {