Skip to content

Commit 8029c6f

Browse files
committed
Fix up Show endpoint callbacks
1 parent 1e1fc4c commit 8029c6f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Endpoint/Show.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ public function __construct(JsonApi $api, ResourceType $resource, $model)
3838

3939
public function handle(Context $context): ResponseInterface
4040
{
41+
run_callbacks($this->resource->getSchema()->getListeners('showing'), [&$this->model, $context]);
42+
4143
$include = $this->getInclude($context);
4244

4345
$this->loadRelationships([$this->model], $include, $context);
4446

45-
run_callbacks($this->resource->getSchema()->getListeners('show'), [&$this->model, $context]);
47+
run_callbacks($this->resource->getSchema()->getListeners('shown'), [&$this->model, $context]);
4648

4749
$serializer = new Serializer($this->api, $context);
4850
$serializer->add($this->resource, $this->model, $include);

src/Schema/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function onShowing(callable $callback): void
220220
}
221221

222222
/**
223-
* Run a callback when a resource is shown.
223+
* Run a callback after a resource is shown.
224224
*/
225225
public function onShown(callable $callback): void
226226
{

0 commit comments

Comments
 (0)