Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Espo\Custom\Hooks\Connection;
- use Espo\ORM\Entity;
- use Espo\ORM\EntityManager;
- use Espo\Core\Record\ReadParams;
- use Espo\Core\Record\Hook\ReadHook;
- class HasBeenRead implements ReadHook
- {
- #private EntityManager $entityManager;
- private $entityManager;
- #public function __construct(EntityManager $entityManager)
- public function __construct(EntityManagerInterface $entityManager)
- {
- $this->entityManager = $entityManager;
- }
- public function process(Entity $entity, ReadParams $params): void
- {
- logger("Calling read hook!");
- $entity->set('status', 'Read');
- $this->entityManager->saveEntity($entity);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment