I have custom Hook file in custom/Espo/Custom/xxx/
(beforeSave, afterSave)
When editing in UI, hooks are normally triggered.
But when I use:
$this->entityManager->saveEntity($entity, $options)
or
$this->getRepository($entityType)->save($entity, $options);
in backend files (custom/Espo/Custom/Service/xxx.php),
these hooks are not triggered !!!
The call sequence is following:
1a) Dropdown action in detail view or
1b) Mass action in list view
2) client/custom/src/xxx-handler.js ->actionDoSomething -> Espo.Ajax.postRequest()
3) route to xxx controller action
4) Controller class function postActionDoSomething is calling Service class function
5) Service class (extends \Espo\Core\Templates\Services\Base) function is calling
$this->entityManager->saveEntity($entity, []);
My questions:
(beforeSave, afterSave)
When editing in UI, hooks are normally triggered.
But when I use:
$this->entityManager->saveEntity($entity, $options)
or
$this->getRepository($entityType)->save($entity, $options);
in backend files (custom/Espo/Custom/Service/xxx.php),
these hooks are not triggered !!!
- The changes to DB are saved correctly,
- Log file is empty
- tried with $options = []
- tried with $options = ['skipHooks' => false]
The call sequence is following:
1a) Dropdown action in detail view or
1b) Mass action in list view
2) client/custom/src/xxx-handler.js ->actionDoSomething -> Espo.Ajax.postRequest()
3) route to xxx controller action
4) Controller class function postActionDoSomething is calling Service class function
5) Service class (extends \Espo\Core\Templates\Services\Base) function is calling
$this->entityManager->saveEntity($entity, []);
My questions:
- Is this intended behavior or bug ?
- What is the proper way to apply some changes in Mass or Detail view functions with respecting all the hooks ?
Comment