- BC Break: Project folder structure changed. Removed `app/main` dir. - BC Break: Core _PHP_ framework + dependencies moved into `composer.json` and are no longer part of this repo
76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: exodus4d
|
|
* Date: 19.05.2015
|
|
* Time: 20:01
|
|
*/
|
|
|
|
namespace Exodus4D\Pathfinder\Model\Pathfinder;
|
|
|
|
use DB\SQL\Schema;
|
|
|
|
class CorporationMapModel extends AbstractPathfinderModel {
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $table = 'corporation_map';
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fieldConf = [
|
|
'active' => [
|
|
'type' => Schema::DT_BOOL,
|
|
'nullable' => false,
|
|
'default' => 1,
|
|
'index' => true
|
|
],
|
|
'corporationId' => [
|
|
'type' => Schema::DT_INT,
|
|
'index' => true,
|
|
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\CorporationModel',
|
|
'constraint' => [
|
|
[
|
|
'table' => 'corporation',
|
|
'on-delete' => 'CASCADE'
|
|
]
|
|
]
|
|
],
|
|
'mapId' => [
|
|
'type' => Schema::DT_INT,
|
|
'index' => true,
|
|
'belongs-to-one' => 'Exodus4D\Pathfinder\Model\Pathfinder\MapModel',
|
|
'constraint' => [
|
|
[
|
|
'table' => 'map',
|
|
'on-delete' => 'CASCADE'
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
/**
|
|
* see parent
|
|
*/
|
|
public function clearCacheData(){
|
|
// clear map cache
|
|
$this->mapId->clearCacheData();
|
|
}
|
|
|
|
/**
|
|
* overwrites parent
|
|
* @param null $db
|
|
* @param null $table
|
|
* @param null $fields
|
|
* @return bool
|
|
* @throws \Exception
|
|
*/
|
|
public static function setup($db = null, $table = null, $fields = null){
|
|
if($status = parent::setup($db, $table, $fields)){
|
|
$status = parent::setMultiColumnIndex(['corporationId', 'mapId'], true);
|
|
}
|
|
return $status;
|
|
}
|
|
} |