mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
types
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ class Sms extends Entity implements SmsInterface
|
||||
|
||||
private function getSmsRepository(): SmsRepository
|
||||
{
|
||||
/** @var SmsRepository */
|
||||
return $this->entityManager->getRepository(self::ENTITY_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class User extends Person
|
||||
}
|
||||
}
|
||||
|
||||
public function setTitle(?string $title): ?string
|
||||
public function setTitle(?string $title): self
|
||||
{
|
||||
$this->set('title', $title);
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ class Numbers
|
||||
|
||||
private function getPhoneNumberRepository(): PhoneNumberRepository
|
||||
{
|
||||
/** @var PhoneNumberRepository */
|
||||
return $this->entityManager->getRepository(PhoneNumber::ENTITY_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class Call extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getCallService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ class Campaign extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getCampaignService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class CaseObj extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getCaseService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ class Document extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getDocumentService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ class KnowledgeBaseArticle extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getArticleService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ class Lead extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getLeadService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class Meeting extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getMeetingService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ class Opportunity extends \Espo\Core\Controllers\Record
|
||||
|
||||
private function getOpportunityService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ class TargetList extends Record
|
||||
|
||||
private function getTargetListService(): Service
|
||||
{
|
||||
/** @var Service */
|
||||
return $this->getRecordService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ class Document extends \Espo\Services\Record
|
||||
|
||||
private function getAttachmentRepository(): AttachmentRepository
|
||||
{
|
||||
/** @var AttachmentRepository */
|
||||
return $this->entityManager->getRepository(Attachment::ENTITY_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user