Example #1
0
 public function __invoke(Request $req, Response $res)
 {
     $school = $req->getAttribute('school', false);
     if (!$school->id) {
         return $res->withStatus(403, 'No school');
     }
     $id = $req->getParam('id', false);
     if (!$id) {
         $res = $res->withStatus(404);
         return $res;
     }
     try {
         $this->schoolAssetsService->removeAssetFromSchool($school->id, $id);
         $res = $res->withStatus(204);
     } catch (Exception $ex) {
         $res = $res->withStatus(500, $ex->getMessage());
     }
     return $res;
 }