getEntity($id); $fields = Request::input('fields', ''); $relations = Request::input('relations', ''); $relations = !empty($relations) ? explode(',', $relations) : []; $fields = !empty($fields) ? explode(',', $fields) : []; return $this->ok(SerializerRegistry::getInstance()->getSerializer($entity)->serialize( Request::input('expand', ''), $fields, $relations )); } catch (ValidationException $ex) { Log::warning($ex); return $this->error412(array($ex->getMessage())); } catch (EntityNotFoundException $ex) { Log::warning($ex); return $this->error404(array('message' => $ex->getMessage())); } catch (\HTTP401UnauthorizedException $ex) { Log::warning($ex); return $this->error401(); } catch (HTTP403ForbiddenException $ex) { Log::warning($ex); return $this->error403(); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } }