Big update: New way of storing build errors, updated UI, AdminLTE 2, fixes, etc.

This commit is contained in:
Dan Cryer 2015-10-15 10:07:54 +01:00
commit 7f823b37cf
821 changed files with 164244 additions and 19321 deletions

View file

@ -75,25 +75,34 @@ class UserStoreBase extends Store
}
/**
* Get a single User by Name.
* @return null|User
* Get multiple User by Name.
* @return array
*/
public function getByName($value, $useConnection = 'read')
public function getByName($value, $limit = 1000, $useConnection = 'read')
{
if (is_null($value)) {
throw new HttpException('Value passed to ' . __FUNCTION__ . ' cannot be null.');
}
$query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT 1';
$query = 'SELECT * FROM `user` WHERE `name` = :name LIMIT :limit';
$stmt = Database::getConnection($useConnection)->prepare($query);
$stmt->bindValue(':name', $value);
$stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT);
if ($stmt->execute()) {
if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
return new User($data);
}
}
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return null;
$map = function ($item) {
return new User($item);
};
$rtn = array_map($map, $res);
$count = count($rtn);
return array('items' => $rtn, 'count' => $count);
} else {
return array('items' => array(), 'count' => 0);
}
}
}