refactoring

This commit is contained in:
Yuri Kuznetsov
2020-06-30 10:11:26 +03:00
parent 9c6bec3761
commit 10793ebdda
8 changed files with 50 additions and 62 deletions
@@ -32,8 +32,13 @@ namespace Espo\Modules\Crm\Repositories;
use Espo\ORM\Entity;
use Espo\Core\Utils\Util;
class Meeting extends \Espo\Core\Repositories\Event
use Espo\Core\Di;
class Meeting extends \Espo\Core\Repositories\Event implements Di\ConfigAware, Di\UserAware
{
use Di\ConfigSetter;
use Di\UserSetter;
protected function beforeSave(Entity $entity, array $options = [])
{
if (!$entity->isNew() && $entity->isAttributeChanged('parentId')) {
@@ -97,7 +102,7 @@ class Meeting extends \Espo\Core\Repositories\Event
parent::beforeSave($entity, $options);
if (!$this->getConfig()->get('eventAssignedUserIsAttendeeDisabled')) {
if (!$this->config->get('eventAssignedUserIsAttendeeDisabled')) {
if ($entity->hasLinkMultipleField('assignedUsers')) {
$assignedUserIdList = $entity->getLinkMultipleIdList('assignedUsers');
foreach ($assignedUserIdList as $assignedUserId) {
@@ -116,7 +121,7 @@ class Meeting extends \Espo\Core\Repositories\Event
}
if ($entity->isNew()) {
$currentUserId = $this->getEntityManager()->getUser()->id;
$currentUserId = $this->user->id;
if (
$entity->hasLinkMultipleId('users', $currentUserId)
&&
@@ -36,7 +36,12 @@ use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\BadRequest;
class Meeting extends \Espo\Services\Record {
use Espo\Core\Di;
class Meeting extends \Espo\Services\Record implements
Di\HookManagerAware
{
use Di\HookManagerSetter;
protected $validateRequiredSkipFieldList = [
'dateEnd'
@@ -219,7 +224,7 @@ class Meeting extends \Espo\Services\Record {
'inviteeId' => $userId,
];
$this->getEntityManager()->getHookManager()->process($this->entityType, 'afterConfirmation', $entity, [], $actionData);
$this->hookManager->process($this->entityType, 'afterConfirmation', $entity, [], $actionData);
return true;
}