From 8029c6fd4accadcf74b8ee445b2151110096d4a4 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 5 May 2021 14:15:19 +0930 Subject: [PATCH] Fix up Show endpoint callbacks --- src/Endpoint/Show.php | 4 +++- src/Schema/Type.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Endpoint/Show.php b/src/Endpoint/Show.php index f50b9e3..9f209ca 100644 --- a/src/Endpoint/Show.php +++ b/src/Endpoint/Show.php @@ -38,11 +38,13 @@ class Show public function handle(Context $context): ResponseInterface { + run_callbacks($this->resource->getSchema()->getListeners('showing'), [&$this->model, $context]); + $include = $this->getInclude($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->add($this->resource, $this->model, $include); diff --git a/src/Schema/Type.php b/src/Schema/Type.php index 3d939f0..8101000 100644 --- a/src/Schema/Type.php +++ b/src/Schema/Type.php @@ -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 {