43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers;
|
|
|
|
use lib\Services\DefenceService;
|
|
use lib\Configs\Pagination;
|
|
|
|
class DefenceController extends DBMSController
|
|
{
|
|
private ?DefenceService $_clientService = null;
|
|
public function __construct(array $params = [])
|
|
{
|
|
parent::__construct($params);
|
|
$this->setPath('defence');
|
|
} //
|
|
public function getDefenceService(): DefenceService
|
|
{
|
|
if ($this->_clientService === null) {
|
|
$this->_clientService = new DefenceService();
|
|
}
|
|
return $this->_clientService;
|
|
}
|
|
|
|
//방어 defense_index.php
|
|
//CLI 접속방법 : php index.php site/defence/index/zone/존/parent/부모키/child/자식키
|
|
//WEB 접속방법 : http://localhost/site/defence/index/zone/존/parent/부모키/child/자식키
|
|
public function index()
|
|
{
|
|
$zone = $this->request->get('zone');
|
|
if (!$zone) {
|
|
throw new \Exception("zone 값이 정의되지 않았습니다.");
|
|
}
|
|
$this->zone = urldecode($zone);
|
|
$this->getDefenceService()->getModel()->where(['zone' => $this->zone]);
|
|
$this->getDefenceService()->getModel()->orderBy(['zone' => 'asc', 'parents' => 'asc', 'child' => 'asc']);
|
|
[$this->total, $this->entities, $this->pagination, $this->curPage, $this->perPage] = $this->getDefenceService()->getList(
|
|
$this->request->get('curPage'),
|
|
$this->request->get('perPage')
|
|
);
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|