src/Sulu/Component/Rest/RestController.php
protected function responseGetById($id, $findCallback)
    {
        $entity = $findCallback($id);

        if (!$entity) {
            $exception = new EntityNotFoundException(self::$entityName, $id);
            // Return a 404 together with an error message, given by the exception, if the entity is not found
            $view = $this->view(
                $exception->toArray(),
                404
            );
        } else {
            $view = $this->view($entity, 200);
        }

        return $view;
    }
protected function responseGetById($id, $findCallback)
    {
        $entity = $findCallback($id);

        if (!$entity) {
            $exception = new EntityNotFoundException(self::$entityName, $id);
            // Return a 404 together with an error message, given by the exception, if the entity is not found
            $view = $this->view(
                $exception->toArray(),
                404
            );
        } else {
            $view = $this->view($entity, 200);
        }

        return $view;
    }
protected function responseGetById ( $ id , $ findCallback ) { $ entity = $ findCallback ( $ id ) ; if ( ! $ entity ) { $ exception = new EntityNotFoundException ( self :: $ entityName , $ id ) ; // Return a 404 together with an error message, given by the exception, if the entity is not found $ view = $ this -> view ( $ exception -> toArray ( ) , 404 ) ; } else { $ view = $ this -> view ( $ entity , 200 ) ; } return $ view ; }
Returns the response with the entity with the given id, or a response with a status of 404, in case the entity
is not found. The find method is injected by a callback.

@param $id
@param callable $findCallback

@return View
Returns the response with the entity with the given id or a response with a status of 404 in case the entity is not found . The find method is injected by a callback .