Hooks Sample Request

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    Hooks Sample Request

    Hi,
    I have follow all "doc/forum/google" about a simple "hook" for a Entity.

    I have created file at : custom/Espo/Custom/Hooks/Contact/ContactName.php

    with this

    <?php
    namespace Espo\Custom\Hooks\Contact;

    use Espo\ORM\Entity;

    class ContactName extends Espo\Core\Hooks\Base
    {
    public function beforeSave(Entity $entity, array $options = array())
    {
    $entity->set("lastName",strtoupper( $entity->get('lastName')) );

    }
    }
    ?>

    do a clear cache
    logoff, login..

    And never hook fire.

    What I have wrong ?

    Error : PHP Fatal error: Class 'Espo\Custom\Hooks\Contact\Espo\Core\Hooks\Base' not found in /Applications/MAMP/htdocs/custom/Espo/Custom/Hooks/Contact/ContactName.php on line 6

    Thanks






    Last edited by item; 12-16-2017, 12:18 PM.
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    class ContactName extends \Espo\Core\Hooks\Base

    Comment

    Working...