notFound() public static method

Is thrown when resource's not found
public static notFound ( string $message = '', Exception | Throwable $previous = NULL ) : BadRequestException
$message string
$previous Exception | Throwable
return BadRequestException
示例#1
0
 /**
  * Returns single database record as associative array
  * @param int $id
  * @return array item
  * @throws Drahak\Restful\Application\BadRequestException
  */
 protected function getItem($id)
 {
     if (($row = $this->table->get($id)) === FALSE) {
         throw BadRequestException::notFound('No record for ID: ' . $id);
     }
     $item = $row->toArray();
     if ($this->deepListing) {
         $this->getDeepData($item, $row, $this->deepListing);
     }
     if (count($this->metadata) > 0) {
         $item['metadata'] = $this->metadata;
     }
     return $item;
 }