Hooks error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DevMostafa
    Member
    • Mar 2017
    • 36

    Hooks error

    tanya I've added a new hook file which always gives me a PHP error:

    [Wed Feb 07 13:15:26.288032 2018] [:error] [pid 64097] [client 10.20.16.71:55948] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /var/www/espo/application/Espo/ORM/DB/Query/Base.php on line 414

    I've attached the Hook file and I want to know if there's a trigger make the Hook dynamic without save the entity.
    Attached Files
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    You save the contact in afterSave... and this triggers afterSave hook, and you save the contact again, and this triggers afterSave hook, and you save the contact again,and this triggers afterSave hook, and you save the contact again,and this triggers afterSave hook, and you save the contact again (LOOP)

    $this->getEntityManager()->saveEntity($contactEntity, ['skipHooks' => true]);

    Comment


    • DevMostafa
      DevMostafa commented
      Editing a comment
      Hello Tanya,
      I made it and have this error in the log file:

      [2018-02-07 13:20:50] Espo.ERROR: Uncaught Exception TypeError: "Argument 1 passed to Espo\ORM\DB\Mapper::select() must be an instance of Espo\ORM\IEntity, null given, called in /var/www/espo/application/Espo/ORM/Repositories/RDB.php on line 187" at /var/www/espo/application/Espo/ORM/DB/Mapper.php line 103 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Espo\\ORM\\DB\\Mapper::select() must be an instance of Espo\\ORM\\IEntity, null given, called in /var/www/espo/application/Espo/ORM/Repositories/RDB.php on line 187 at /var/www/espo/application/Espo/ORM/DB/Mapper.php:103)"} []
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #3
    Somewhere you want to load entity, which not exists. Check all getEntity and getRepository.

    Comment


    • DevMostafa
      DevMostafa commented
      Editing a comment
      Now it didn't give errors, but saving took many time and didn't return yet.
Working...