ref, comments

This commit is contained in:
Yuri Kuznetsov
2024-03-01 16:07:57 +02:00
parent 13c8fc15f4
commit fba82f8697
3 changed files with 18 additions and 35 deletions
@@ -50,6 +50,7 @@ class EmailTemplate extends Record implements
/**
* @deprecated For bc. Use `Espo\Tools\EmailTemplate\Processor`.
* @todo Remove in v9.0.
*
* @param array<string, mixed> $params
* @return array{
@@ -96,6 +97,7 @@ class EmailTemplate extends Record implements
/**
* @deprecated For bc. Use `Espo\Tools\EmailTemplate\Service`.
* @todo Remove in v9.0.
*
* @param array<string, mixed> $params
* @return array<string, mixed>
+13 -32
View File
@@ -33,6 +33,7 @@ use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\Utils\Config;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\Entities\Integration as IntegrationEntity;
use Espo\Entities\User;
use Espo\ORM\Entity;
use Espo\ORM\EntityManager;
@@ -41,29 +42,12 @@ use stdClass;
class Integration
{
/** @var EntityManager */
protected $entityManager;
/** @var User */
protected $user;
/** @var Config */
protected $config;
/** @var ConfigWriter */
protected $configWriter;
public function __construct(
EntityManager $entityManager,
User $user,
Config $config,
ConfigWriter $configWriter
) {
$this->entityManager = $entityManager;
$this->user = $user;
$this->config = $config;
$this->configWriter = $configWriter;
}
private EntityManager $entityManager,
private User $user,
private Config $config,
private ConfigWriter $configWriter
) {}
/**
* @return void
@@ -84,7 +68,7 @@ class Integration
{
$this->processAccessCheck();
$entity = $this->entityManager->getEntity('Integration', $id);
$entity = $this->entityManager->getEntityById(IntegrationEntity::ENTITY_TYPE, $id);
if (!$entity) {
throw new NotFound();
@@ -101,7 +85,7 @@ class Integration
{
$this->processAccessCheck();
$entity = $this->entityManager->getEntity('Integration', $id);
$entity = $this->entityManager->getEntityById(IntegrationEntity::ENTITY_TYPE, $id);
if (!$entity) {
throw new NotFound();
@@ -111,18 +95,15 @@ class Integration
$this->entityManager->saveEntity($entity);
$integrationsConfigData = $this->config->get('integrations') ?? (object) [];
$configData = $this->config->get('integrations') ?? (object) [];
if (!($integrationsConfigData instanceof stdClass)) {
$integrationsConfigData = (object) [];
if (!$configData instanceof stdClass) {
$configData = (object) [];
}
$integrationName = $id;
$integrationsConfigData->$integrationName = $entity->get('enabled');
$this->configWriter->set('integrations', $integrationsConfigData);
$configData->$id = $entity->get('enabled');
$this->configWriter->set('integrations', $configData);
$this->configWriter->save();
return $entity;
+3 -3
View File
@@ -31,7 +31,6 @@ namespace Espo\Services;
use Espo\Core\Exceptions\NotFound;
use Espo\ORM\Entity;
use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\Forbidden;
use Espo\Tools\Pdf\Data;
@@ -41,7 +40,7 @@ use Espo\Entities\Template;
/**
* @deprecated Left for bc.
* @todo Remove in v10.0.
* @todo Remove in v9.0.
*/
class Pdf
{
@@ -54,6 +53,7 @@ class Pdf
}
/**
* @deprecated
* @throws Error
* @throws Forbidden
*/
@@ -74,7 +74,7 @@ class Pdf
* @throws Forbidden
* @throws NotFound
*
* @deprecated Left for bc.
* @deprecated
*/
public function buildFromTemplate(
Entity $entity,