39 lines
827 B
PHP
39 lines
827 B
PHP
<?php
|
|
|
|
namespace lib\Services;
|
|
|
|
use lib\Entities\HistoryEntity as Entity;
|
|
use lib\Models\HistoryModel as Model;
|
|
|
|
class HistoryService extends CommonService
|
|
{
|
|
private ?Model $_model = null;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
final public function getClassName(): string
|
|
{
|
|
return "History";
|
|
}
|
|
final public function getClassPath(): string
|
|
{
|
|
return $this->getClassName();
|
|
}
|
|
protected function getModel(): Model
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new Model();
|
|
// $this->_model->setDebug(true);
|
|
}
|
|
return $this->_model;
|
|
}
|
|
|
|
public function getNews(int $limit = 5): array
|
|
{
|
|
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
|
$this->getModel()->limit($limit);
|
|
return $this->getModel()->getEntitys();
|
|
}
|
|
}
|