I have written a few Hooks and came across something which may be by design or a bug, I'm not sure.
I have 2 hooks in 2 separate Modules
Modules\Module1\Hooks\Account\AccountHooks.php with a beforeSave
Modules\Module2\Hooks\Account\AccountHooks.php with a beforeSave
When the hooks.php cache is built only one of the 2 hooks appears. If I rename the file and content of Module 2 to AccountHooks2.php then the hook is correctly generated in the cache.
So... it appears that the class name of the hook for a given hook type must be unique in order to get cached properly.
My general naming convention was to call hook files {entityType}\ {entityName}Hooks.php, but I have now found that a couple of hooks are clashing.
Is this by design or am I doing something wrong?
Thanks
I have 2 hooks in 2 separate Modules
Modules\Module1\Hooks\Account\AccountHooks.php with a beforeSave
Modules\Module2\Hooks\Account\AccountHooks.php with a beforeSave
When the hooks.php cache is built only one of the 2 hooks appears. If I rename the file and content of Module 2 to AccountHooks2.php then the hook is correctly generated in the cache.
So... it appears that the class name of the hook for a given hook type must be unique in order to get cached properly.
My general naming convention was to call hook files {entityType}\ {entityName}Hooks.php, but I have now found that a couple of hooks are clashing.
Is this by design or am I doing something wrong?
Thanks
Comment