이동 구현. BaseCommand에 GeneralSource 연결.

This commit is contained in:
2018-10-16 02:29:33 +09:00
parent d16c86a4d7
commit 9846d7f8e4
10 changed files with 250 additions and 65 deletions
+19 -3
View File
@@ -37,7 +37,7 @@ abstract class BaseCommand{
protected $runnableConstraints = null;
protected $reservableConstraints = null;
protected $generalSource = null;
protected $logger;
@@ -54,6 +54,17 @@ abstract class BaseCommand{
}
public function setGeneralSource(?array $generalSource){
$this->generalSource = $generalSource;
}
protected function getGeneralObjFromGeneralSource(int $generalNo):?General{
if($this->generalSource === null){
return null;
}
return $this->generalSource[$generalNo]??null;
}
protected function resetTestCache():void{
$this->runnable = null;
$this->reservable = null;
@@ -105,7 +116,12 @@ abstract class BaseCommand{
protected function setDestCity(int $cityNo, ?array $args){
$this->resetTestCache();
$db = DB::db();
if($args == null){
if($args === []){
$cityObj = \sammo\CityConst::byID($cityNo);
$this->destCity = ['city'=>$cityNo, 'name'=>$cityObj->name];
return;
}
if($args === null){
$this->destCity = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $cityNo);
return;
}
@@ -114,7 +130,7 @@ abstract class BaseCommand{
protected function setDestNation(int $nationNo, ?array $args = null){
$this->resetTestCache();
if($args == null){
if($args === null || $args === []){
$this->destNation = getNationStaticInfo($nationNo);
return;
}