1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Accommodation_Management/models/AccomodationServices.php

38 lines
873 B
PHP
Raw Permalink Normal View History

2020-12-18 20:29:24 +01:00
<?php
class AccomodationServices extends Model
{
private $data;
2020-12-20 03:56:05 +01:00
public function __construct($data = null)
{
parent::__construct();
$_col = get_class()::getColumns();
if($data !== null){
forEach($data as $key=>$value){
if(!key_exists($key, $_col)){
throw new Exception('Invalid data entry');
}else{
$this->data[$key] = $value;
}
}
}
return $this;
}
2021-01-05 17:53:26 +01:00
public static function getAll(): array
{
$out = [];
forEach(AccomodationServices::fetch() as $item){
$out[] = $item->getName();
}
return $out;
}
public function getName(): string
{
if(isset($this->data['name']))
return $this->data['name'];
return false;
}
2020-12-18 20:29:24 +01:00
}