PHPdoc and small fixes

This commit is contained in:
Julius Haertl
2016-10-28 00:45:03 +02:00
parent 1faa3481f8
commit 9bbe4b9137
19 changed files with 261 additions and 189 deletions

View File

@@ -25,7 +25,7 @@ namespace OCA\Deck\Db;
use JsonSerializable;
class Board extends \OCA\Deck\Db\Entity implements JsonSerializable {
class Board extends Entity implements JsonSerializable {
public $id;
protected $title;

View File

@@ -40,10 +40,10 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
}
/**
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
*/
/**
* @param $id
* @return \OCP\AppFramework\Db\Entity if not found
*/
public function find($id) {
$sql = 'SELECT id, title, owner, color, archived FROM `*PREFIX*deck_boards` ' .
'WHERE `id` = ?';
@@ -79,13 +79,16 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
}
return $entries;
}
/**
* Find all boards for a given user
* @param $groups
* @param null $limit
* @param null $offset
* @return array
*/
/**
* Find all boards for a given user
*
* @param $userId
* @param $groups
* @param null $limit
* @param null $offset
* @return array
*/
public function findAllByGroups($userId, $groups, $limit=null, $offset=null) {
if(count($groups)<=0) {
return [];

View File

@@ -54,10 +54,10 @@ class CardMapper extends Mapper implements IPermissionMapper {
}
/**
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
*/
/**
* @param $id
* @return Entity if not found
*/
public function find($id) {
$sql = 'SELECT * FROM `*PREFIX*deck_cards` ' .
'WHERE `id` = ?';
@@ -68,7 +68,6 @@ class CardMapper extends Mapper implements IPermissionMapper {
}
public function findAll($stackId, $limit=null, $offset=null) {
// TODO: Exclude fields like text
$sql = 'SELECT * FROM `*PREFIX*deck_cards`
WHERE `stack_id` = ? AND NOT archived ORDER BY `order`';
$entities = $this->findEntities($sql, [$stackId], $limit, $offset);

View File

@@ -28,8 +28,8 @@ use OCP\AppFramework\Db\Mapper;
abstract class DeckMapper extends Mapper {
/**
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
* @param $id
* @return \OCP\AppFramework\Db\Entity if not found
*/
public function find($id) {
$sql = 'SELECT * FROM `' . $this->tableName . '` ' . 'WHERE `id` = ?';

View File

@@ -27,8 +27,6 @@ namespace OCA\Deck\Db;
interface IPermissionMapper {
// FIXME: Optimize implementations as e.g. BoardMapper::isOwner doesn't need to select all fields
/**
* Check if $userId is owner of Entity with $id
*

View File

@@ -60,7 +60,7 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
$labels = $this->findAssignedLabelsForBoard($boardId);
$result = array();
foreach ($labels as $label) {
if(!is_array($result[$label->getCardId()])) {
if(!array_key_exists($label->getCardId(), $result)) {
$result[$label->getCardId()] = array();
}
$result[$label->getCardId()][] = $label;

View File

@@ -38,10 +38,10 @@ class StackMapper extends Mapper implements IPermissionMapper {
}
/**
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
*/
/**
* @param $id
* @return Entity if not found
*/
public function find($id) {
$sql = 'SELECT * FROM `*PREFIX*deck_stacks` ' .
'WHERE `id` = ?';