47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Libraries\MyStorage\Mangboard;
|
|
|
|
use App\Models\Mangboard\BoardsModel;
|
|
use App\Entities\Mangboard\UserEntity;
|
|
use App\Entities\Mangboard\BoardsEntity;
|
|
|
|
class BoardsLibrary
|
|
{
|
|
private $_model = null;
|
|
private $_entity = null;
|
|
private $_board_name = null;
|
|
private $_user_entity = null;
|
|
public function __construct(string $board_name, UserEntity $uer_entity)
|
|
{
|
|
$this->_board_name = $board_name;
|
|
$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($this->getBoardName());
|
|
}
|
|
return $this->_entity;
|
|
}
|
|
//---------------------------------------------------------------------//
|
|
public function getBoardName(): string
|
|
{
|
|
return $this->_board_name;
|
|
}
|
|
public function getUserEntity(): UserEntity
|
|
{
|
|
if ($this->_user_entity === null) {
|
|
throw new \Exception("사용자정보가 없습니다.");
|
|
}
|
|
return $this->_user_entity;
|
|
}
|
|
}
|