diff options
Implemented a getall values from db method in JobOffer and show results in index
2 files changed, 10 insertions, 0 deletions
| -rw-r--r-- | src/index.php | 3 | ||||
| -rw-r--r-- | src/models/JobOffer.php | 7 |
diff --git a/src/index.php b/src/index.php index 285f6e7..6f290d6 100644 --- a/src/index.php +++ b/src/index.php @@ -3,4 +3,7 @@ include_once("models/JobOffer.php"); $jb = new JobOffer("a", "", "", 0); + foreach(JobOffer::getAll() as $key => $obj) { + echo $obj->salary . "<br>"; + } ?> diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 5cd6de4..736d644 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -18,4 +18,11 @@ class JobOffer extends DBModel { self::$DB->createTable(self::TABLE_NAME, self::TABLE_COLUMNS); } + + /** + * @return JobOffer[] + */ + static function getAll() { + return self::$DB->getAllValues(self::TABLE_NAME); + } } |
