2016-08-04 05:59:04 +02:00
|
|
|
<?php
|
2016-08-20 23:06:41 +02:00
|
|
|
use RedBeanPHP\Facade as RedBean;
|
2016-08-04 05:59:04 +02:00
|
|
|
|
|
|
|
class Department extends DataStore {
|
|
|
|
const TABLE = 'department';
|
|
|
|
|
2016-08-05 01:21:51 +02:00
|
|
|
public static function getProps() {
|
2016-08-04 05:59:04 +02:00
|
|
|
return [
|
|
|
|
'name',
|
2016-12-08 03:43:32 +01:00
|
|
|
'sharedTicketList',
|
2016-08-04 05:59:04 +02:00
|
|
|
];
|
|
|
|
}
|
2016-08-20 23:06:41 +02:00
|
|
|
|
|
|
|
public static function getDepartmentNames() {
|
2016-10-03 21:44:41 +02:00
|
|
|
$departmentsList = RedBean::findAll(Department::TABLE);
|
2016-08-20 23:06:41 +02:00
|
|
|
$departmentsNameList = [];
|
2016-10-03 21:44:41 +02:00
|
|
|
|
|
|
|
foreach($departmentsList as $department) {
|
2016-11-21 03:01:38 +01:00
|
|
|
$departmentsNameList[] = [
|
|
|
|
'id' => $department->id,
|
|
|
|
'name' => $department->name
|
|
|
|
];
|
2016-08-20 23:06:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $departmentsNameList;
|
|
|
|
}
|
2016-08-04 05:59:04 +02:00
|
|
|
}
|