id generator usage
This commit is contained in:
@@ -29,22 +29,17 @@
|
||||
|
||||
namespace Espo\Tools\Kanban;
|
||||
|
||||
use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
Utils\Metadata,
|
||||
};
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Id\RecordIdGenerator;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
|
||||
class Orderer
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $metadata;
|
||||
|
||||
public function __construct(EntityManager $entityManager, Metadata $metadata)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private Metadata $metadata,
|
||||
private RecordIdGenerator $idGenerator
|
||||
) {}
|
||||
|
||||
public function setEntityType(string $entityType): OrdererProcessor
|
||||
{
|
||||
@@ -70,7 +65,8 @@ class Orderer
|
||||
{
|
||||
return new OrdererProcessor(
|
||||
$this->entityManager,
|
||||
$this->metadata
|
||||
$this->metadata,
|
||||
$this->idGenerator
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
namespace Espo\Tools\Kanban;
|
||||
|
||||
use Espo\Core\Utils\Id\RecordIdGenerator;
|
||||
use Espo\Entities\KanbanOrder;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
use LogicException;
|
||||
|
||||
@@ -47,14 +47,11 @@ class OrdererProcessor
|
||||
|
||||
private int $maxNumber = self::DEFAULT_MAX_NUMBER;
|
||||
|
||||
private EntityManager $entityManager;
|
||||
private Metadata $metadata;
|
||||
|
||||
public function __construct(EntityManager $entityManager, Metadata $metadata)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
public function __construct(
|
||||
private EntityManager $entityManager,
|
||||
private Metadata $metadata,
|
||||
private RecordIdGenerator $idGenerator
|
||||
) {}
|
||||
|
||||
public function setEntityType(string $entityType): self
|
||||
{
|
||||
@@ -165,7 +162,7 @@ class OrdererProcessor
|
||||
$item = $this->entityManager->getNewEntity(KanbanOrder::ENTITY_TYPE);
|
||||
|
||||
$item->set([
|
||||
'id' => Util::generateId(),
|
||||
'id' => $this->idGenerator->generate(),
|
||||
'entityId' => $id,
|
||||
'entityType' => $this->entityType,
|
||||
'group' => $this->group,
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
namespace Espo\Tools\Notification;
|
||||
|
||||
use Espo\Core\Utils\Id\RecordIdGenerator;
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\Notification;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Email;
|
||||
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Util;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\WebSocket\Submission;
|
||||
use Espo\Core\Utils\DateTime as DateTimeUtil;
|
||||
@@ -45,22 +45,13 @@ use Espo\ORM\EntityManager;
|
||||
|
||||
class Service
|
||||
{
|
||||
private EntityManager $entityManager;
|
||||
private Config $config;
|
||||
private AclManager $aclManager;
|
||||
private Submission $webSocketSubmission;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
Config $config,
|
||||
AclManager $aclManager,
|
||||
Submission $webSocketSubmission
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
$this->aclManager = $aclManager;
|
||||
$this->webSocketSubmission = $webSocketSubmission;
|
||||
}
|
||||
private EntityManager $entityManager,
|
||||
private Config $config,
|
||||
private AclManager $aclManager,
|
||||
private Submission $webSocketSubmission,
|
||||
private RecordIdGenerator $idGenerator
|
||||
) {}
|
||||
|
||||
public function notifyAboutMentionInPost(string $userId, Note $note): void
|
||||
{
|
||||
@@ -131,7 +122,7 @@ class Service
|
||||
$notification = $this->entityManager->getNewEntity(Notification::ENTITY_TYPE);
|
||||
|
||||
$notification->set([
|
||||
'id' => Util::generateId(),
|
||||
'id' => $this->idGenerator->generate(),
|
||||
'data' => [
|
||||
'noteId' => $note->getId(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user