37 lines
746 B
PHP
37 lines
746 B
PHP
<?php
|
|
|
|
namespace lib\Services;
|
|
|
|
use lib\Entities\HistoryEntity as Entity;
|
|
use lib\Models\HistoryModel as Model;
|
|
|
|
class HistoryService extends CommonService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
final public function getClassName(): string
|
|
{
|
|
return "History";
|
|
}
|
|
final public function getClassPath(): string
|
|
{
|
|
return $this->getClassName();
|
|
}
|
|
public function getModelClass(): string
|
|
{
|
|
return Model::class;
|
|
}
|
|
public function getEntityClass(): string
|
|
{
|
|
return Entity::class;
|
|
}
|
|
public function getNews(int $limit = 5): array
|
|
{
|
|
$this->getModel()->orderBy($this->getModel()->getPKField(), 'DESC');
|
|
$this->getModel()->limit($limit);
|
|
return $this->getEntities();
|
|
}
|
|
}
|