vhost init...2

This commit is contained in:
최준흠 2024-05-14 10:06:41 +09:00
parent 229e7e0fa9
commit 438003707f
10 changed files with 12 additions and 18 deletions

View File

@ -60,6 +60,9 @@ abstract class BaseModel extends Model
$this->_session = \Config\Services::session();
$this->_validation = \Config\Services::validation();
}
abstract public function getTitleField(): string;
abstract public function getEntity($conditions): BaseEntity;
final protected function getClassName()
{
return $this->_className;
@ -78,15 +81,10 @@ abstract class BaseModel extends Model
}
return $this->_categoryModel;
}
abstract public function getTitleField(): string;
final public function getPrimaryKey()
{
return $this->primaryKey;
}
public function getEntity($conditions): BaseEntity
{
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function getEntitys(array $conditions = array()): array
{
return $this->where($conditions)->findAll();

View File

@ -65,7 +65,7 @@ class BillingModel extends BaseModel
}
public function getEntity($conditions): BillingEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function create(array $formDatas): BillingEntity
{

View File

@ -54,9 +54,8 @@ class BoardModel extends BaseHierarchyModel
}
public function getEntity($conditions): BoardEntity
{
return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}해당 데이터가 없습니다.");
}
public function create(array $formDatas): BoardEntity
{
return $this->create_process(new BoardEntity(), $formDatas);

View File

@ -117,7 +117,7 @@ class CategoryModel extends BaseHierarchyModel
public function getEntity($conditions): CategoryEntity
{
return new CategoryEntity(parent::getEntity($conditions)->toArray());
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function getEntitys(array $conditions = array()): array
{

View File

@ -37,7 +37,7 @@ class OrderBillingModel extends BaseModel
}
public function getEntity($conditions): OrderBillingEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function create(array $formDatas): OrderBillingEntity
{

View File

@ -74,7 +74,7 @@ class OrderModel extends BaseModel
}
public function getEntity($conditions): OrderEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function create(array $formDatas): OrderEntity
{

View File

@ -65,7 +65,7 @@ class ProductModel extends BaseModel
public function getEntity($conditions): ProductEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function create(array $formDatas): ProductEntity
{

View File

@ -49,9 +49,8 @@ class SitepageModel extends BaseModel
public function getEntity($conditions): SitepageEntity
{
return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}해당 데이터가 없습니다.");
}
public function create(array $formDatas): SitepageEntity
{
return $this->create_process(new SitepageEntity(), $formDatas);

View File

@ -57,9 +57,8 @@ class UserModel extends BaseModel
}
public function getEntity($conditions): UserEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
{
switch ($field) {

View File

@ -49,9 +49,8 @@ class UserSNSModel extends BaseModel
}
public function getEntity($conditions): UserSNSEntity
{
return parent::getEntity($conditions);
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
}
public function create(array $formDatas): UserSNSEntity
{
return $this->create_process(new UserSNSEntity(), $formDatas);