diff options
author | Joas Schilling <coding@schilljs.com> | 2019-01-21 15:23:47 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-02-20 14:17:33 +0300 |
commit | 46e51bd63b33d1af0af31e0e26bafd24a9f1451e (patch) | |
tree | 1043115462dbc0223308b583fe009debfd17abb8 /lib/Model | |
parent | c0e34c872902c2b324656dcc3d00c9fc60eced1d (diff) |
Add routes and controller
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Model')
-rw-r--r-- | lib/Model/Command.php | 4 | ||||
-rw-r--r-- | lib/Model/CommandMapper.php | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Model/Command.php b/lib/Model/Command.php index aa2c68603..2870543b0 100644 --- a/lib/Model/Command.php +++ b/lib/Model/Command.php @@ -36,6 +36,10 @@ use OCP\AppFramework\Db\Entity; */ class Command extends Entity { + public const OUTPUT_NONE = 0; + public const OUTPUT_USER = 1; + public const OUTPUT_ALL = 2; + /** @var string */ protected $name; diff --git a/lib/Model/CommandMapper.php b/lib/Model/CommandMapper.php index 680710f2c..4107e7324 100644 --- a/lib/Model/CommandMapper.php +++ b/lib/Model/CommandMapper.php @@ -45,4 +45,18 @@ class CommandMapper extends QBMapper { return $this->findEntities($qb); } + + /** + * @param int $id + * @return Command + * @throws \OCP\AppFramework\Db\DoesNotExistException + */ + public function findById(int $id): Command { + $query = $this->db->getQueryBuilder(); + $query->select('*') + ->from($this->getTableName()) + ->where($query->expr()->eq('id', $query->createNamedParameter($id))); + + return $this->findEntity($query); + } } |