Via a hook, I'm trying to 'touch' a file when I update an account record. This is my first attempt to use a hook. The hook does not work. Can anyone tell me why? Here is the code:
Maybe EspoCRM does not let you do anything outside the system via hooks?
Help is appreciated.
Code:
<?php
namespace Espo\Custom\Hooks\Accounts;
use Espo\ORM\Entity;
class MyHook
{
// An optional parameter, defines in which order hooks will be processed.
// Lesser value means sooner.
//public static int $order = 5;
//public function __construct(
// Define needed dependencies.
//) {}
public function afterSave(Entity $entity, array $options): void
{
$filename = "/usr/home/xxxxx/public_html/xxxx.com/XXX-test-php.txt";
touch($filename);
}
}
​
Help is appreciated.

it should namespace Espo\Custom\Hooks\Account; (Account) with s.
Comment