40 lines
817 B
PHP
40 lines
817 B
PHP
<?php
|
|
|
|
namespace lib\Services;
|
|
|
|
use lib\Entities\DefenceEntity as Entity;
|
|
use lib\Models\DefenceModel as Model;
|
|
|
|
class DefenceService extends CommonService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
final public function getClassName(): string
|
|
{
|
|
return "Defence";
|
|
}
|
|
final public function getClassPath(): string
|
|
{
|
|
return $this->getClassName();
|
|
}
|
|
public function getModelClass(): string
|
|
{
|
|
return Model::class;
|
|
}
|
|
public function getEntityClass(): string
|
|
{
|
|
return Entity::class;
|
|
}
|
|
|
|
public function getMKList(mixed $zone = null): array
|
|
{
|
|
if ($zone !== null) {
|
|
$this->getModel()->setWhere(['zone' => $zone]);
|
|
}
|
|
$this->getModel()->orderBy(['zone' => 'asc', 'parents' => 'asc', 'child' => 'asc']);
|
|
return $this->getEntities();
|
|
}
|
|
}
|