override AfterFetch.php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • concept
    Junior Member
    • Sep 2023
    • 17

    override AfterFetch.php

    hello,
    I’m trying to override the class​ Espo\Core\Mail\Account\GroupAccount\Hooks\AfterFet ch.php, am adding features in the emailToCase method.
    I extended this class : Espo\Custom\Core\Mail\Account\GroupAccount\Hooks\A fterFetch.php , however the program does not consider the extension and works with the core file.
    Does anyone have any ideas?
    Thanks!

    Code:

    <?php

    namespace Espo\Custom\Core\Mail\Account\GroupAccount\Hooks;

    ​use \Espo\ORM\EntityManager;

    class AfterFetch extends \Espo\Core\Mail\Account\GroupAccount\Hooks\AfterFe tch
    {
    //myMethod
    }
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    Here is the factory that creates a Fetcher instance. You can see it binds a specific AfterFetch implementation.

    You can bind a custom FetcherFactory with binding. Your custom factory could bind your custom AfterFetch implementation.

    Here's the default binding for the FetcherFactory. Use it as example for your custom binding.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • concept
      Junior Member
      • Sep 2023
      • 17

      #3
      Originally posted by yuri
      Here is the factory that creates a Fetcher instance. You can see it binds a specific AfterFetch implementation.

      You can bind a custom FetcherFactory with binding. Your custom factory could bind your custom AfterFetch implementation.

      Here's the default binding for the FetcherFactory. Use it as example for your custom binding.
      Thank you!
      But what directory should this Binding.php have?
      custom\Espo\Custom\Binding.php?​

      Comment

      • concept
        Junior Member
        • Sep 2023
        • 17

        #4
        in my version of espo, v 7.1.11, the binding.php file is located in application/Espo/Core/Binding and is called 'DefaultBinding.php' and not in application/Espo.
        I tried to do the override by copying and pasting the code and changing only the namespace in Espo/Custom as reported by the documentation, but my espo goes to error 500 and does not allow me to enter, so I deleted the file and everything is back to normal, but my AfterFetch in Custom\Core\Mail\Account\GroupAccount\Hooks continues to be ignored.
        I just don’t know how to proceed to start my AfterFetch extension​

        Comment

        Working...