rename DBCore::defaultInstance()

This commit is contained in:
maxpozdeev 2023-03-24 18:23:06 +03:00
parent 8815569861
commit a41eae1ea7
5 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ if (!$listData) {
die("No list found.");
}
$data = DBCore::defaultInstance()->getTasksByListId($listId, '', (int)$listData['sorting']);
$data = DBCore::default()->getTasksByListId($listId, '', (int)$listData['sorting']);
if (_get('format') == 'ical') {
printICal($listData, $data);

View file

@ -64,7 +64,7 @@ printRss($data, $listData);
function fillData(array &$data, int $listId, string $field, string $sqlWhere )
{
$tasks = DBCore::defaultInstance()->getTasksByListId($listId, $sqlWhere, "$field DESC", 100);
$tasks = DBCore::default()->getTasksByListId($listId, $sqlWhere, "$field DESC", 100);
$lang = Lang::instance();
foreach ($tasks as $r)
{

View file

@ -191,7 +191,7 @@ class TasksController extends ApiController {
checkWriteAccess();
$id = (int)$id;
if (!DBCore::defaultInstance()->taskExists($id)) {
if (!DBCore::default()->taskExists($id)) {
$this->response->data = ['total' => 0];
return;
}
@ -461,7 +461,7 @@ class TasksController extends ApiController {
private function getTaskRowById(int $id): ?array
{
$r = DBCore::defaultInstance()->getTaskById($id);
$r = DBCore::default()->getTaskById($id);
if (!$r) {
throw new Exception("Failed to fetch task data");
}

View file

@ -44,7 +44,7 @@ class DBCore
* @return DBCore
* @throws Exception
*/
public static function defaultInstance() : DBCore
public static function default() : DBCore
{
if (!isset(self::$defaultInstance)) {
throw new Exception("DBCore defaultInstance is not initialized");

View file

@ -49,7 +49,7 @@ function parseRoute($queryString)
redirectWithHashRoute($hash, $q);
}
else if (isset($q['task'])) {
$listId = (int)DBCore::defaultInstance()->getListIdByTaskId((int)$q['task']);
$listId = (int)DBCore::default()->getListIdByTaskId((int)$q['task']);
if ($listId > 0) {
$h = [ 'list', $listId, 'search', '#'. (int)$q['task']];
redirectWithHashRoute($h);