Hi,
I’ve just checked following:
-
custom/modules/Cases - there is a logic_hooks.php defining several hooks, but this is note a before_Retrieve hook from the log, I’ve commented out all hooks from this file, made a quick repair and rebuild but the same thing happens
-
custom/modules/Notes - no logic_hooks.php defined, custom/modules/Notes/Ext includes only Language and Vardefs subfolders
-
custom/modules - the is a logic_hooks.php in custom/modules folder, defining several hooks, however not related to Notes and not any before_retrieve as captured in logs
The place were I was following the mentioned logs and hook checks is include/utils/LogicHook.php .
In order to get more detailed log, I’ve used the code from:
However, this should not influence the logic of the call_custom_logic function.
As far as I can see, before the problematic queries are executed, following is being called in include/utils/LogicHook.php.
a) call_custom_logic with $module_dir=Notes and $event=before_retrieve
b) the function is checking and trying to get hooks from $module_dir folder and is getting the empty array (no custom hooks defined in Notes module)
c) after previous point, it is calling getHooks(‘’), getting all hooks from custom/modules/logic_hooks.php (previously mentioned in section 3 of my comment)
d) Previous getHooks(‘’) retreives array of hooks and it is calling process_hooks function after that, passing $event=before_retrieve and hooks acquired with getHooks. However, no hooks are related to before_retrieve event so the process_hooks is being skipped because of the following condition:
if (!empty($hook_array[$event])) {
I am not sure about the place where SELECT notes.*,notes_cstm.* FROM notes LEFT JOIN notes_cstm ON notes.id = notes_cstm.id_c WHERE notes.id = '1299a1c0-e303-1a4b-61d6-60a6cdea1efd' AND notes.deleted=0
are starting to being called, but calls are repeated for each note with parent_type = ‘Cases’ with no parent id.
To doble check everything I’ve commented out all logic_hooks.php files (the one from custom/modules, and the one from custom/modules/Cases), and the same thing happens, I still have following logs:
One2MBeanRelationship getQuery: Trying to get property of non-object
Query: SELECT id FROM notes WHERE notes.parent_id = ‘’ AND notes.deleted=0 AND notes.parent_type = ‘Cases’
Hooks check for: Notes::before_retrieve
Hook called: Notes::before_retrieve, hooks not empty 2 (this is the custom log message I’ve added based on the mentioned community topic)
SELECT notes.,notes_cstm.* FROM notes LEFT JOIN notes_cstm ON notes.id = notes_cstm.id_c WHERE notes.id = '7eaa3f25-ab2c-7b10-b595-60a6caed4*
5df’ AND notes.deleted=0
… and the same select for each returned record (WHERE notes.parent_id = ‘’ AND notes.deleted=0 AND notes.parent_type = ‘Cases’)