/** * @param ApiInterface $api * @return object */ protected function locateRecord(ApiInterface $api) { $interpreter = $api->getRequestInterpreter(); if (!($id = $interpreter->getResourceId())) { return null; } $store = $api->getStore(); $identifier = ResourceIdentifier::create($interpreter->getResourceType(), $id); $record = $store->find($identifier); if (!$record) { throw new JsonApiException([], 404); } return $record; }