/**
* 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;
}