diff --git a/application/Espo/EntryPoints/ChangePassword.php b/application/Espo/EntryPoints/ChangePassword.php index b3f085b5f1..44beee24f3 100644 --- a/application/Espo/EntryPoints/ChangePassword.php +++ b/application/Espo/EntryPoints/ChangePassword.php @@ -46,10 +46,13 @@ class ChangePassword implements EntryPoint { use NoAuth; + /** @var Config */ protected $config; + /** @var ClientManager */ protected $clientManager; + /** @var EntityManager */ protected $entityManager; public function __construct(Config $config, ClientManager $clientManager, EntityManager $entityManager) @@ -68,7 +71,7 @@ class ChangePassword implements EntryPoint } $passwordChangeRequest = $this->entityManager - ->getRepository('PasswordChangeRequest') + ->getRDBRepository('PasswordChangeRequest') ->where([ 'requestId' => $requestId, ]) diff --git a/application/Espo/EntryPoints/Download.php b/application/Espo/EntryPoints/Download.php index 6228c5c0c5..8360099216 100644 --- a/application/Espo/EntryPoints/Download.php +++ b/application/Espo/EntryPoints/Download.php @@ -54,10 +54,13 @@ class Download implements EntryPoint 'application/msexcel', ]; + /** @var FileStorageManager */ protected $fileStorageManager; + /** @var Acl */ protected $acl; + /** @var EntityManager */ protected $entityManager; public function __construct(FileStorageManager $fileStorageManager, Acl $acl, EntityManager $entityManager) diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.php index 3b40fa081c..feb80993a6 100644 --- a/application/Espo/EntryPoints/Image.php +++ b/application/Espo/EntryPoints/Image.php @@ -29,6 +29,8 @@ namespace Espo\EntryPoints; +use Espo\Repositories\Attachment as AttachmentRepository; + use Espo\Core\{ Exceptions\NotFound, Exceptions\NotFoundSilent, @@ -54,16 +56,22 @@ class Image implements EntryPoint protected $allowedFieldList = null; + /** @var FileStorageManager */ protected $fileStorageManager; + /** @var Acl */ protected $acl; + /** @var EntityManager */ protected $entityManager; + /** @var FileManager */ protected $fileManager; + /** @var Config */ protected $config; + /** @var Metadata */ private $metadata; public function __construct( @@ -172,7 +180,7 @@ class Image implements EntryPoint return $this->fileManager->getContents($cacheFilePath); } - $filePath = $this->entityManager->getRepository('Attachment')->getFilePath($attachment); + $filePath = $this->getAttachmentRepository()->getFilePath($attachment); if (!$this->fileManager->isFile($filePath)) { throw new NotFound(); @@ -358,4 +366,10 @@ class Image implements EntryPoint { return $this->metadata->get(['app', 'image', 'sizes']) ?? []; } + + protected function getAttachmentRepository(): AttachmentRepository + { + /** @var AttachmentRepository */ + return $this->entityManager->getRepository(Attachment::ENTITY_TYPE); + } } diff --git a/application/Espo/Services/Integration.php b/application/Espo/Services/Integration.php index 0a6f063d1c..64227b2029 100644 --- a/application/Espo/Services/Integration.php +++ b/application/Espo/Services/Integration.php @@ -39,16 +39,28 @@ use Espo\{ Entities\User, }; -use StdClass; +use stdClass; class Integration { + /** + * @var EntityManager + */ protected $entityManager; + /** + * @var User + */ protected $user; + /** + * @var Config + */ protected $config; + /** + * @var ConfigWriter + */ protected $configWriter; public function __construct( @@ -83,7 +95,7 @@ class Integration return $entity; } - public function update(string $id, StdClass $data): Entity + public function update(string $id, stdClass $data): Entity { $this->processAccessCheck(); @@ -99,7 +111,7 @@ class Integration $integrationsConfigData = $this->config->get('integrations') ?? (object) []; - if (!($integrationsConfigData instanceof StdClass)) { + if (!($integrationsConfigData instanceof stdClass)) { $integrationsConfigData = (object) []; } diff --git a/application/Espo/Services/Layout.php b/application/Espo/Services/Layout.php index d49304a559..a0f2f94361 100644 --- a/application/Espo/Services/Layout.php +++ b/application/Espo/Services/Layout.php @@ -48,18 +48,39 @@ use Espo\{ class Layout { + /** + * @var Acl + */ protected $acl; + /** + * @var LayoutUtil + */ protected $layout; + /** + * @var LayoutManager + */ protected $layoutManager; + /** + * @var EntityManager + */ protected $entityManager; + /** + * @var Metadata + */ protected $metadata; + /** + * @var DataManager + */ protected $dataManager; + /** + * @var User + */ protected $user; public function __construct( @@ -132,7 +153,7 @@ class Layout if ($portalId) { $portal = $em - ->getRepository('Portal') + ->getRDBRepository('Portal') ->select(['layoutSetId']) ->where(['id' => $portalId]) ->findOne(); @@ -146,7 +167,7 @@ class Layout if ($teamId) { $team = $em - ->getRepository('Team') + ->getRDBRepository('Team') ->select(['layoutSetId']) ->where(['id' => $teamId]) ->findOne(); @@ -245,7 +266,7 @@ class Layout } $layout = $em - ->getRepository('LayoutRecord') + ->getRDBRepository('LayoutRecord') ->where([ 'layoutSetId' => $setId, 'name' => $fullName,