From 1a01ba21912f4846db3454142afecee69d3bce2a Mon Sep 17 00:00:00 2001 From: xamgore <xamgore@ya.ru> Date: Wed, 18 Mar 2015 14:39:22 +0300 Subject: [PATCH] Removed `create` method from Semesters model --- .../application/classes/Controller/Student/Index.php | 2 +- .../application/classes/Controller/Teacher/Index.php | 2 +- ~dev_rating/application/classes/Model/Semesters.php | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php index 870173905..215e848b1 100644 --- a/~dev_rating/application/classes/Controller/Student/Index.php +++ b/~dev_rating/application/classes/Controller/Student/Index.php @@ -20,7 +20,7 @@ class Controller_Student_Index extends Controller_UserEnvi { $twig->disciplines = $list; $twig->User = $this->UserInfo; $twig->Semester = $this->SemesterInfo; - $twig->SemesterList = Model_Semesters::create()->getList(); + $twig->SemesterList = Model_Semesters::toArray(); $this->response->body($twig); } diff --git a/~dev_rating/application/classes/Controller/Teacher/Index.php b/~dev_rating/application/classes/Controller/Teacher/Index.php index e4202d427..e33d0ec6c 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Index.php +++ b/~dev_rating/application/classes/Controller/Teacher/Index.php @@ -41,7 +41,7 @@ class Controller_Teacher_Index extends Controller_UserEnvi { $disciplinesHandled[$i]['Disciplines'][$j]['Groups'] = implode(', ', $groupsInDiscipline); } //!for_each $twig->Subjects = $disciplinesHandled; - $twig->SemesterList = Model_Semesters::create()->getList(); + $twig->SemesterList = Model_Semesters::toArray(); $twig->Semester = $this->SemesterInfo; $twig->User = $this->UserInfo; $this->response->body($twig); diff --git a/~dev_rating/application/classes/Model/Semesters.php b/~dev_rating/application/classes/Model/Semesters.php index 3180f1afb..77124664a 100644 --- a/~dev_rating/application/classes/Model/Semesters.php +++ b/~dev_rating/application/classes/Model/Semesters.php @@ -2,10 +2,6 @@ class Model_Semesters extends Model { - public static function create() { - return new self(); - } - /** * @param $id int semester id * @return array data from <tt>semesters</tt> table @@ -15,13 +11,13 @@ class Model_Semesters extends Model return DB::query(Database::SELECT, $sql)->execute()->offsetGet(0); } - public function getSemesters() { + public static function getSemesters() { $sql = "CALL `GetSemesters`()"; return DB::query(Database::SELECT, $sql)->execute(); } - public function getList() { - $semesters = $this->getSemesters(); + public static function toArray() { + $semesters = self::getSemesters(); $list = array(); foreach ($semesters as $row) { -- GitLab