Files
pathfinder/app/main/model/pathfinder/structurestatusmodel.php
Mark Friedrich 1de67f8dbf - New "station" data added, closed #858
- Improved system deeplinks. EveEye.com added, closed #859
- Improved cronjob performance for "SovereigntyData" import, closed #853
- Updated static DB dump for `eve_universe.sql`
2019-09-30 19:36:39 +02:00

101 lines
2.3 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: Exodus 4D
* Date: 15.04.2018
* Time: 20:13
*/
namespace Model\Pathfinder;
use DB\SQL\Schema;
class StructureStatusModel extends AbstractPathfinderModel {
/**
* @var string
*/
protected $table = 'structure_status';
/**
* @var array
*/
protected $fieldConf = [
'active' => [
'type' => Schema::DT_BOOL,
'nullable' => false,
'default' => 1,
'index' => true
],
'name' => [
'type' => Schema::DT_VARCHAR128,
'nullable' => false,
'default' => ''
],
'label' => [
'type' => Schema::DT_VARCHAR128,
'nullable' => false,
'default' => ''
],
'class' => [
'type' => Schema::DT_VARCHAR128,
'nullable' => false,
'default' => ''
],
'structures' => [
'has-many' => ['Model\Pathfinder\StructureModel', 'statusId']
]
];
/**
* @var array
*/
protected static $tableData = [
[
'id' => 1,
'name' => 'unknown',
'label' => '',
'class' => 'pf-structure-status-unknown'
],
[
'id' => 2,
'name' => 'online',
'label' => 'online',
'class' => 'pf-structure-status-online'
],
[
'id' => 3,
'name' => 'offline',
'label' => 'offline',
'class' => 'pf-structure-status-offline'
]
];
/**
* get structure status data
* @return \stdClass
*/
public function getData() : \stdClass {
$statusData = (object) [];
$statusData->id = $this->_id;
$statusData->name = $this->name;
$statusData->label = $this->label;
$statusData->class = $this->class;
return $statusData;
}
/**
* get all status options
* @return \DB\CortexCollection
*/
public static function getAll(){
$query = [
'active = :active',
':active' => 1
];
return (new self())->find($query);
}
}