이동 구현. BaseCommand에 GeneralSource 연결.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user