Created
March 8, 2018 18:00
-
-
Save piiskop/25d00af3e2bad85eadfb8f87fb44dcf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace pupils; | |
class StudyGroup { | |
private $id; | |
private $name; | |
/** | |
* | |
* @return mixed | |
*/ | |
public function getId() { | |
return $this->id; | |
} | |
/** | |
* | |
* @return mixed | |
*/ | |
public function getName() { | |
return $this->name; | |
} | |
/** | |
* | |
* @param mixed $id | |
*/ | |
public function setId($id) { | |
$this->id = $id; | |
} | |
/** | |
* | |
* @param mixed $name | |
*/ | |
public function setName($name) { | |
$this->name = $name; | |
} | |
public function __construct($arguments) { | |
if (isset($arguments['id'])) { | |
$this->setId($arguments['id']); | |
} | |
if (isset($arguments['name'])) { | |
$this->setName($arguments['name']); | |
} | |
} | |
public static function findAll() { | |
$_SESSION['dbEngine']->queryDatabase( | |
array ( | |
'queryString' => 'SELECT idStudyGroup, name FROM StudyGroup' | |
)); | |
return $_SESSION['dbEngine']->getRecords(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment