type fixes
This commit is contained in:
@@ -147,7 +147,7 @@ class Note extends Entity
|
||||
$attachmentsIds = $data->attachmentsIds;
|
||||
|
||||
$collection = $this->entityManager
|
||||
->getRepository('Attachment')
|
||||
->getRDBRepository('Attachment')
|
||||
->select(['id', 'name', 'type'])
|
||||
->order('createdAt')
|
||||
->where([
|
||||
|
||||
@@ -79,9 +79,8 @@ class Avatar extends Image implements Di\MetadataAware
|
||||
|
||||
public function run(Request $request, Response $response): void
|
||||
{
|
||||
$userId = $request->get('id');
|
||||
|
||||
$size = $request->get('size') ?? null;
|
||||
$userId = $request->getQueryParam('id');
|
||||
$size = $request->getQueryParam('size') ?? null;
|
||||
|
||||
if (!$userId) {
|
||||
throw new BadRequest();
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConfirmOptIn implements EntryPoint
|
||||
|
||||
public function run(Request $request, Response $response): void
|
||||
{
|
||||
$id = $request->get('id');
|
||||
$id = $request->getQueryParam('id');
|
||||
|
||||
if (!$id) {
|
||||
throw new BadRequest();
|
||||
|
||||
@@ -49,8 +49,8 @@ class LogoImage extends Image implements Di\ConfigAware
|
||||
|
||||
public function run(Request $request, Response $response): void
|
||||
{
|
||||
$id = $request->get('id');
|
||||
$size = $request->get('size') ?? null;
|
||||
$id = $request->getQueryParam('id');
|
||||
$size = $request->getQueryParam('size') ?? null;
|
||||
|
||||
if (!$id) {
|
||||
$id = $this->config->get('companyLogoId');
|
||||
|
||||
@@ -87,7 +87,7 @@ class Pdf implements EntryPoint
|
||||
->setHeader('Content-Disposition', 'inline; filename="' . basename($fileName) . '"');
|
||||
|
||||
if (!$request->getServerParam('HTTP_ACCEPT_ENCODING')) {
|
||||
$response->setHeader('Content-Length', $contents->getLength());
|
||||
$response->setHeader('Content-Length', strlen($contents));
|
||||
}
|
||||
|
||||
$response->writeBody($contents);
|
||||
|
||||
@@ -69,7 +69,7 @@ class WebSocketSubmit
|
||||
}
|
||||
|
||||
$scope = $entity->getEntityType();
|
||||
$id = $entity->id;
|
||||
$id = $entity->getId();
|
||||
|
||||
if (!$this->metadata->get(['scopes', $scope, 'object'])) {
|
||||
return;
|
||||
|
||||
@@ -31,22 +31,27 @@ namespace Espo\Hooks\Integration;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Entities\Integration;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Config\ConfigWriter,
|
||||
};
|
||||
|
||||
class GoogleMaps
|
||||
{
|
||||
protected $configWriter;
|
||||
private $configWriter;
|
||||
|
||||
public function __construct(ConfigWriter $configWriter)
|
||||
{
|
||||
$this->configWriter = $configWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Integration $entity
|
||||
*/
|
||||
public function afterSave(Entity $entity)
|
||||
{
|
||||
if ($entity->id !== 'GoogleMaps') {
|
||||
if ($entity->getId() !== 'GoogleMaps') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace Espo\Hooks\Portal;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Entities\Portal;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\Config,
|
||||
Utils\Config\ConfigWriter,
|
||||
@@ -38,9 +40,9 @@ use Espo\Core\{
|
||||
|
||||
class WriteConfig
|
||||
{
|
||||
protected $config;
|
||||
private $config;
|
||||
|
||||
protected $configWriter;
|
||||
private $configWriter;
|
||||
|
||||
public function __construct(Config $config, ConfigWriter $configWriter)
|
||||
{
|
||||
@@ -48,6 +50,9 @@ class WriteConfig
|
||||
$this->configWriter = $configWriter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Portal $entity
|
||||
*/
|
||||
public function afterSave(Entity $entity)
|
||||
{
|
||||
if (!$entity->has('isDefault')) {
|
||||
@@ -57,17 +62,16 @@ class WriteConfig
|
||||
if ($entity->get('isDefault')) {
|
||||
$defaultPortalId = $this->config->get('defaultPortalId');
|
||||
|
||||
if ($defaultPortalId === $entity->id) {
|
||||
if ($defaultPortalId === $entity->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->configWriter->set('defaultPortalId', $entity->id);
|
||||
$this->configWriter->set('defaultPortalId', $entity->getId());
|
||||
|
||||
$this->configWriter->save();
|
||||
}
|
||||
|
||||
if ($entity->isAttributeChanged('isDefault') && $entity->getFetched('isDefault')) {
|
||||
|
||||
$this->configWriter->set('defaultPortalId', null);
|
||||
|
||||
$this->configWriter->save();
|
||||
|
||||
@@ -31,19 +31,22 @@ namespace Espo\Hooks\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\{
|
||||
Utils\ApiKey as ApiKeyUtil,
|
||||
};
|
||||
use Espo\Core\Utils\ApiKey as ApiKeyUtil;
|
||||
|
||||
use Espo\Entities\User;
|
||||
|
||||
class ApiKey
|
||||
{
|
||||
protected $apiKey;
|
||||
private $apiKey;
|
||||
|
||||
public function __construct(ApiKeyUtil $apiKey)
|
||||
{
|
||||
$this->apiKey = $apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $entity
|
||||
*/
|
||||
public function afterSave(Entity $entity)
|
||||
{
|
||||
if (!$entity->isApi()) {
|
||||
@@ -57,17 +60,20 @@ class ApiKey
|
||||
$entity->isAttributeChanged('authMethod')
|
||||
)
|
||||
) {
|
||||
$this->apiKey->storeSecretKeyForUserId($entity->id, $entity->get('secretKey'));
|
||||
$this->apiKey->storeSecretKeyForUserId($entity->getId(), $entity->get('secretKey'));
|
||||
}
|
||||
|
||||
if (
|
||||
$entity->isAttributeChanged('authMethod') &&
|
||||
$entity->get('authMethod') !== 'Hmac'
|
||||
) {
|
||||
$this->apiKey->removeSecretKeyForUserId($entity->id);
|
||||
$this->apiKey->removeSecretKeyForUserId($entity->getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $entity
|
||||
*/
|
||||
public function afterRemove(Entity $entity)
|
||||
{
|
||||
if (!$entity->isApi()) {
|
||||
@@ -75,7 +81,7 @@ class ApiKey
|
||||
}
|
||||
|
||||
if ($entity->isApi() && $entity->get('authMethod') === 'Hmac') {
|
||||
$this->apiKey->removeSecretKeyForUserId($entity->id);
|
||||
$this->apiKey->removeSecretKeyForUserId($entity->getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\Table,
|
||||
@@ -58,6 +60,8 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
return true;
|
||||
}
|
||||
|
||||
assert($entity instanceof CoreEntity);
|
||||
|
||||
if ($data->getRead() === Table::LEVEL_OWN || $data->getRead() === Table::LEVEL_TEAM) {
|
||||
if ($entity->hasLinkMultipleId('users', $user->getId())) {
|
||||
return true;
|
||||
|
||||
@@ -33,6 +33,8 @@ use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\Table,
|
||||
@@ -58,6 +60,8 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
return true;
|
||||
}
|
||||
|
||||
assert($entity instanceof CoreEntity);
|
||||
|
||||
if ($data->getRead() === Table::LEVEL_OWN || $data->getRead() === Table::LEVEL_TEAM) {
|
||||
if ($entity->hasLinkMultipleId('users', $user->getId())) {
|
||||
return true;
|
||||
|
||||
@@ -33,6 +33,8 @@ use Espo\Entities\User;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
Acl\ScopeData,
|
||||
Acl\AccessEntityCREDChecker,
|
||||
@@ -61,6 +63,8 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
assert($entity instanceof CoreEntity);
|
||||
|
||||
$portalIdList = $entity->getLinkMultipleIdList('portals');
|
||||
|
||||
$portalId = $user->get('portalId');
|
||||
|
||||
@@ -31,13 +31,15 @@ namespace Espo\Modules\Crm\Classes\FieldProcessing\Call;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
use StdClass;
|
||||
use stdClass;
|
||||
|
||||
class PhoneNumberMapLoader implements Loader
|
||||
{
|
||||
@@ -54,6 +56,8 @@ class PhoneNumberMapLoader implements Loader
|
||||
{
|
||||
$map = (object) [];
|
||||
|
||||
assert($entity instanceof CoreEntity);
|
||||
|
||||
$contactIdList = $entity->getLinkMultipleIdList('contacts');
|
||||
|
||||
if (count($contactIdList)) {
|
||||
@@ -69,7 +73,7 @@ class PhoneNumberMapLoader implements Loader
|
||||
$entity->set('phoneNumbersMap', $map);
|
||||
}
|
||||
|
||||
private function populate(StdClass $map, string $entityType, array $idList): void
|
||||
private function populate(stdClass $map, string $entityType, array $idList): void
|
||||
{
|
||||
$entityList = $this->entityManager
|
||||
->getRDBRepository($entityType)
|
||||
|
||||
+4
@@ -31,6 +31,8 @@ namespace Espo\Modules\Crm\Classes\FieldProcessing\TargetList;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Modules\Crm\Entities\TargetList;
|
||||
|
||||
use Espo\Core\{
|
||||
FieldProcessing\Loader,
|
||||
FieldProcessing\Loader\Params,
|
||||
@@ -57,6 +59,8 @@ class OptedOutCountLoader implements Loader
|
||||
return;
|
||||
}
|
||||
|
||||
assert($entity instanceof TargetList);
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->targetsLinkList as $link) {
|
||||
|
||||
Reference in New Issue
Block a user