Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
add phpdoc to mappers
Browse files Browse the repository at this point in the history
  • Loading branch information
Henni committed Sep 4, 2015
1 parent 5262afb commit 2e00e50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions db/devicemapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ public function __construct(IDBConnection $db) {
}

/**
* @param string $hash
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Device
*/
public function findByHash($hash) {
$sql = 'SELECT * FROM `*PREFIX*maps_location_track_users` '.
Expand All @@ -21,15 +23,23 @@ public function findByHash($hash) {
}

/**
* @param int $id
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Device
*/
public function findById($id) {
$sql = 'SELECT * FROM `*PREFIX*maps_location_track_users` '.
'WHERE `id` = ?';
return $this->findEntity($sql, [$id]);
}

/**
* @param string $userId
* @param int $limit
* @param int $offset
* @return Device[]
*/
public function findAll($userId, $limit=null, $offset=null) {
$sql = 'SELECT * FROM `*PREFIX*maps_location_track_users`'.
'WHERE `user_id` = ?';
Expand Down
16 changes: 15 additions & 1 deletion db/locationmapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,37 @@ public function __construct(IDBConnection $db) {
}

/**
* @param int $id
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @return Location
*/
public function find($id) {
$sql = 'SELECT * FROM `*PREFIX*maps_locations` '.
'WHERE `id` = ?';
return $this->findEntity($sql, [$id]);
}

/**
* @param string $deviceHash
* @param string $from
* @param string $until
* @param int $limit
* @param int $offset
* @return Location[]
*/
public function findBetween($deviceHash, $from, $until, $limit=null, $offset=null) {
$sql = 'SELECT * FROM `*PREFIX*maps_locations` '.
'WHERE `device_hash` = ?'.
'AND `timestamp` BETWEEN ? and ?';
return $this->findEntities($sql, [$deviceHash, $from, $until], $limit, $offset);
}


/**
* @param int $limit
* @param int $offset
* @return Location[]
*/
public function findAll($limit=null, $offset=null) {
$sql = 'SELECT * FROM `*PREFIX*maps_locations`';
return $this->findEntities($sql, $limit, $offset);
Expand Down

0 comments on commit 2e00e50

Please sign in to comment.