vhost init...2
This commit is contained in:
parent
229e7e0fa9
commit
438003707f
@ -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();
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user