Пример #1
0
 /**
  * @NoAdminRequired
  *
  * @param int $sketchId
  * @param int $id
  * @return DataResponse
  */
 public function destroy($sketchId, $id)
 {
     try {
         $line = $this->lineMapper->find($sketchId, $id, $this->userId);
     } catch (Exception $e) {
         return new DataResponse([], Http::STATUS_NOT_FOUND);
     }
     $this->lineMapper->delete($line);
     // Delete related points
     foreach ($this->pointMapper->findAll($id, $this->userId) as $point) {
         $this->pointMapper->delete($point);
     }
     return new DataResponse($line);
 }
Пример #2
0
 /**
  * @param Line $line
  * @param string $userId
  */
 public function addPoints(Line $line, $userId)
 {
     $line->setPoints($this->pointMapper->findAll($line->getId(), $userId));
 }