type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-02 19:56:48 +02:00
parent d833d43a8b
commit 4a12d44971
7 changed files with 24 additions and 32 deletions

View File

@@ -99,6 +99,7 @@ class JobRunner
throw new Error();
}
/** @var JobEntity $jobEntity */
$jobEntity = $this->entityManager->getEntity(JobEntity::ENTITY_TYPE, $id);
if (!$jobEntity) {

View File

@@ -86,9 +86,8 @@ class ScheduleUtil
$runTime = date(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT);
}
$entityManager = $this->entityManager;
$scheduledJob = $entityManager->getEntity(ScheduledJobEntity::ENTITY_TYPE, $scheduledJobId);
/** @var ScheduledJobEntity $scheduledJob */
$scheduledJob = $this->entityManager->getEntity(ScheduledJobEntity::ENTITY_TYPE, $scheduledJobId);
if (!$scheduledJob) {
return;
@@ -96,9 +95,9 @@ class ScheduleUtil
$scheduledJob->set('lastRun', $runTime);
$entityManager->saveEntity($scheduledJob, ['silent' => true]);
$this->entityManager->saveEntity($scheduledJob, ['silent' => true]);
$scheduledJobLog = $entityManager->getEntity(ScheduledJobLogRecordEntity::ENTITY_TYPE);
$scheduledJobLog = $this->entityManager->getEntity(ScheduledJobLogRecordEntity::ENTITY_TYPE);
$scheduledJobLog->set([
'scheduledJobId' => $scheduledJobId,
@@ -109,6 +108,6 @@ class ScheduleUtil
'targetType' => $targetType,
]);
$entityManager->saveEntity($scheduledJobLog);
$this->entityManager->saveEntity($scheduledJobLog);
}
}

View File

@@ -170,7 +170,7 @@ class EmailSender
if (!$this->systemInboundEmailIsCached && $address) {
$this->systemInboundEmail = $this->entityManager
->getRepository('InboundEmail')
->getRDBRepository('InboundEmail')
->where([
'status' => 'Active',
'useSmtp' => true,

View File

@@ -29,11 +29,10 @@
namespace Espo\Core\Record;
use Espo\ORM\{
Collection as OrmCollection,
};
use Espo\ORM\Collection as OrmCollection;
use Espo\ORM\EntityCollection;
use StdClass;
use stdClass;
/**
* Contains an an ORM collection and total number of records.
@@ -73,11 +72,14 @@ class Collection
/**
* Get a value map list.
*
* @return StdClass[]
* @return stdClass[]
*/
public function getValueMapList(): array
{
if (!$this->collection->getEntityType()) {
if (
$this->collection instanceof EntityCollection &&
!$this->collection->getEntityType()
) {
$list = [];
foreach ($this->collection as $e) {

View File

@@ -164,7 +164,7 @@ class Config
}
/**
* @deprecated Since v6.2.0.
* @deprecated Since v7.0.
*/
public function set($name, $value = null, bool $dontMarkDirty = false)
{
@@ -190,7 +190,7 @@ class Config
}
/**
* @deprecated Since v6.2.0.
* @deprecated Since v7.0.
*/
public function remove(string $name): bool
{
@@ -206,7 +206,7 @@ class Config
}
/**
* @deprecated Since v6.2.0.
* @deprecated Since v7.0.
*/
public function save()
{
@@ -253,24 +253,14 @@ class Config
$data['microtime'] = $microtime = microtime(true);
$result = $this->fileManager->putPhpContents($configPath, $data, true);
$this->fileManager->putPhpContents($configPath, $data);
if ($result) {
$reloadedData = include($configPath);
$this->changedData = [];
$this->removeData = [];
if (!is_array($reloadedData) || $microtime !== ($reloadedData['microtime'] ?? null)) {
$result = $this->fileManager->putPhpContents($configPath, $data, false);
}
}
$this->load();
if ($result) {
$this->changedData = [];
$this->removeData = [];
$this->load();
}
return $result;
return true;
}
private function isLoaded(): bool

View File

@@ -228,7 +228,6 @@ class SystemRequirements
$actualValue = $this->systemHelper->getPhpParam($name);
$acceptable = (
isset($actualValue) &&
Util::convertToByte($actualValue) >= Util::convertToByte($requiredValue)
) ? true : false;

View File

@@ -1,5 +1,6 @@
parameters:
level: 1
inferPrivatePropertyTypeFromConstructor: true
paths:
- application
reportUnmatchedIgnoredErrors: false