43 lines
1.6 KiB
PHP
43 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Equipment\ServerPart;
|
|
|
|
use App\Entities\Customer\ServiceEntity;
|
|
use App\Entities\Equipment\ServerPartEntity;
|
|
use App\Interfaces\Equipment\ServerPartInterface;
|
|
use App\Services\Customer\ServiceService as ParentService;
|
|
|
|
//서버연결정보 추가나 변경,삭제시 가격이 변한경우 서비스의 가격을 변경하기 위함.
|
|
class ServiceService extends ParentService implements ServerPartInterface
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
private function action_process(ServerPartEntity $serverPartEntity): ServiceEntity
|
|
{
|
|
//Service Entity 가져오기
|
|
$entity = $this->getEntity($serverPartEntity->getServiceInfoUID());
|
|
if (!$entity instanceof ServiceEntity) {
|
|
throw new \Exception("[{$serverPartEntity->getServiceInfoUID()}]에 대한 서비스정보를 찾을수 없습니다.");
|
|
}
|
|
//서비스금액은 modify 함수내에서 재계산을 하므로 여기서는 modify만 호출함
|
|
return parent::modify($entity, []);
|
|
}
|
|
public function createServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
|
{
|
|
$this->action_process($serverPartEntity);
|
|
return $serverPartEntity;
|
|
}
|
|
//create와 같은 작업임
|
|
public function modifyServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
|
{
|
|
return $this->createServerPart($serverPartEntity);
|
|
}
|
|
//create와 같은 작업임
|
|
public function deleteServerPart(ServerPartEntity $serverPartEntity): ServerPartEntity
|
|
{
|
|
return $this->createServerPart($serverPartEntity);
|
|
}
|
|
}
|