. * */ namespace OCA\News\Db; use \OCA\AppFramework\Db\DoesNotExistException; use \OCA\AppFramework\Db\MultipleObjectsReturnedException; use \OCA\AppFramework\Db\Mapper; use \OCA\AppFramework\Core\API; abstract class NewsMapper extends Mapper { public function __construct(API $api, $tableName) { parent::__construct($api, $tableName); } protected function findRow($sql, $id, $userId){ $result = $this->execute($sql, array($id, $userId)); $row = $result->fetchRow(); if($row === false){ throw new DoesNotExistException('Item does not exist!'); } elseif($result->fetchRow() !== false) { throw new MultipleObjectsReturnedException('More than one result for Item with id ' . $id . '!'); } else { return $row; } } }