/**
  * @inheritdoc
  */
 public function execute(Request $request, DataSourceInterface $resource, $identifier)
 {
     $instance = $resource->update($identifier, $request->attributes->get(AuthorizationListener::API_REQUEST_PAYLOAD));
     if (is_null($instance)) {
         throw new NotFoundHttpException();
     }
     return ActionResult::instance(200, $resource->read($identifier));
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function execute(Request $request, DataSourceInterface $resource, $identifier)
 {
     $instance = $resource->read($identifier);
     if (is_null($instance)) {
         throw new NotFoundHttpException();
     }
     return ActionResult::instance(200, $instance);
 }
 /**
  * @inheritdoc
  */
 public function execute(Request $request, DataSourceInterface $resource)
 {
     return ActionResult::instance(201, $resource->create($request->attributes->get(AuthorizationListener::API_REQUEST_PAYLOAD)));
 }