37 lines
871 B
PHP
37 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\UserModel;
|
|
use App\Entities\UserEntity;
|
|
|
|
class UserService extends CommonService
|
|
{
|
|
private ?UserModel $_model = null;
|
|
public function __construct()
|
|
{
|
|
$this->class_name = "User";
|
|
parent::__construct();
|
|
$this->class_path .= $this->class_name;
|
|
}
|
|
protected function getModel(): UserModel
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new UserModel();
|
|
}
|
|
return $this->_model;
|
|
}
|
|
public function create(array $formDatas): UserEntity
|
|
{
|
|
return $this->getModel()->create($formDatas);
|
|
}
|
|
public function modify(UserEntity $entity, array $formDatas): UserEntity
|
|
{
|
|
return $this->getModel()->modify($entity, $formDatas);
|
|
}
|
|
public function delete(): void
|
|
{
|
|
$this->getModel()->delete();
|
|
}
|
|
}
|