This commit is contained in:
Yuri Kuznetsov
2021-11-04 16:16:22 +02:00
parent d125d8f067
commit 6e31c591bd
17 changed files with 30 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ use Espo\Core\{
/**
* @template T of \Espo\Core\ORM\Entity
* @extends RDBRepository<\Espo\Core\ORM\Entity>
* @extends RDBRepository<T>
*/
class Database extends RDBRepository
{

View File

@@ -294,6 +294,7 @@ class Email extends Entity
$idList[] = $id;
/** @var Attachment */
$attachment = $this->entityManager->getEntity('Attachment', $id);
if ($attachment) {
@@ -510,6 +511,7 @@ class Email extends Entity
private function getEmailRepository(): EmailRepository
{
/** @var EmailRepository */
return $this->entityManager->getRepository(self::ENTITY_TYPE);
}
}

View File

@@ -137,6 +137,7 @@ class Sms extends Entity implements SmsInterface
private function getSmsRepository(): SmsRepository
{
/** @var SmsRepository */
return $this->entityManager->getRepository(self::ENTITY_TYPE);
}
}

View File

@@ -152,7 +152,7 @@ class User extends Person
}
}
public function setTitle(?string $title): ?string
public function setTitle(?string $title): self
{
$this->set('title', $title);

View File

@@ -106,6 +106,7 @@ class Numbers
private function getPhoneNumberRepository(): PhoneNumberRepository
{
/** @var PhoneNumberRepository */
return $this->entityManager->getRepository(PhoneNumber::ENTITY_TYPE);
}
}

View File

@@ -99,6 +99,7 @@ class Call extends \Espo\Core\Controllers\Record
private function getCallService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -61,6 +61,7 @@ class Campaign extends \Espo\Core\Controllers\Record
private function getCampaignService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -55,6 +55,7 @@ class CaseObj extends \Espo\Core\Controllers\Record
private function getCaseService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -59,6 +59,7 @@ class Document extends \Espo\Core\Controllers\Record
private function getDocumentService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -132,6 +132,7 @@ class KnowledgeBaseArticle extends \Espo\Core\Controllers\Record
private function getArticleService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -76,6 +76,7 @@ class Lead extends \Espo\Core\Controllers\Record
private function getLeadService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -99,6 +99,7 @@ class Meeting extends \Espo\Core\Controllers\Record
private function getMeetingService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -116,6 +116,7 @@ class Opportunity extends \Espo\Core\Controllers\Record
private function getOpportunityService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -97,6 +97,7 @@ class TargetList extends Record
private function getTargetListService(): Service
{
/** @var Service */
return $this->getRecordService();
}
}

View File

@@ -75,6 +75,7 @@ class Document extends \Espo\Services\Record
private function getAttachmentRepository(): AttachmentRepository
{
/** @var AttachmentRepository */
return $this->entityManager->getRepository(Attachment::ENTITY_TYPE);
}
}

View File

@@ -40,6 +40,9 @@ use Espo\Services\Record;
use Espo\Repositories\Attachment as AttachmentRepository;
use Espo\Entities\Attachment;
use Espo\Modules\Crm\Entities\Account;
use Espo\Modules\Crm\Entities\Opportunity;
use Espo\Modules\Crm\Entities\Contact;
use Espo\Core\Di;
@@ -88,6 +91,7 @@ class Lead extends Record implements
public function getConvertAttributes(string $id): array
{
/** @var LeadEntity */
$lead = $this->getEntity($id);
if (!$this->getAcl()->check($lead, 'read')) {
@@ -219,6 +223,7 @@ class Lead extends Record implements
public function convert(string $id, object $recordsData, ?object $additionalData = null): LeadEntity
{
/** @var LeadEntity */
$lead = $this->getEntity($id);
$additionalData = $additionalData ?? (object) [];
@@ -239,6 +244,8 @@ class Lead extends Record implements
$account->set(get_object_vars($recordsData->Account));
if ($duplicateCheck) {
/** @var Account[] */
/** @var iterable<Account> */
$rDuplicateList = $this->recordServiceContainer
->get('Account')
->findDuplicates($account);
@@ -269,6 +276,8 @@ class Lead extends Record implements
}
if ($duplicateCheck) {
/** @var Contact[] */
/** @var iterable<Contact> */
$rDuplicateList = $this->recordServiceContainer
->get('Contact')
->findDuplicates($contact);
@@ -305,6 +314,8 @@ class Lead extends Record implements
}
if ($duplicateCheck) {
/** @var Opportunity[] */
/** @var iterable<Opportunity> */
$rDuplicateList = $this->recordServiceContainer
->get('Opportunity')
->findDuplicates($opportunity);
@@ -450,6 +461,7 @@ class Lead extends Record implements
private function getAttachmentRepository(): AttachmentRepository
{
/** @var AttachmentRepository */
return $this->entityManager->getRepository(Attachment::ENTITY_TYPE);
}
}

View File

@@ -208,6 +208,8 @@ class RDBRepository implements Repository
/**
* Get an access point for a specific relation of a record.
*
* @phpstan-param T $entity
*/
public function getRelation(Entity $entity, string $relationName): RDBRelation
{