49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Libraries\Mangboard;
|
|
|
|
use App\Libraries\CommonLibrary;
|
|
use App\Models\Mangboard\BoardsModel;
|
|
use App\Entities\Mangboard\UserEntity;
|
|
use App\Entities\Mangboard\BoardsEntity;
|
|
|
|
class Boards extends CommonLibrary
|
|
{
|
|
private $_model = null;
|
|
private $_entity = null;
|
|
private $_category = null;
|
|
private $_user_entity = null;
|
|
public function __construct(string $category, UserEntity $uer_entity)
|
|
{
|
|
parent::__construct();
|
|
$this->_category = $category;
|
|
$this->_user_entity = $uer_entity;
|
|
}
|
|
public function getModel(): BoardsModel
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new BoardsModel();
|
|
}
|
|
return $this->_model;
|
|
}
|
|
public function getEntity(): BoardsEntity
|
|
{
|
|
if ($this->_entity === null) {
|
|
$this->_entity = $this->getModel()->getEntityByID("board_" . $this->getCategory());
|
|
}
|
|
return $this->_entity;
|
|
}
|
|
//---------------------------------------------------------------------//
|
|
public function getCategory(): string
|
|
{
|
|
return $this->_category;
|
|
}
|
|
public function getUserEntity(): UserEntity
|
|
{
|
|
if ($this->_user_entity === null) {
|
|
throw new \Exception("사용자정보가 없습니다.");
|
|
}
|
|
return $this->_user_entity;
|
|
}
|
|
}
|