Announcement

Collapse
No announcement yet.

Implementing a custom GlobalSearch\Service and binding it with the DI binder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Implementing a custom GlobalSearch\Service and binding it with the DI binder

    Hello,

    I'm interested in achieving a pretty similar thing as here. I need to somehow override the native logic behind search (and eventually Notifications for other task, but I assume the process will be similar). I have a method that looks up Opportunities associated with Leads (Lead has a name, Opportunity has a different name, that obviously doesn't show up, but I want to show it as a result if associated Lead name is searched, but that's only for context, not what I'm asking here, I got the logic part handled), but the thing is, I don't fully understand how to implement the DI binder. The docs say you need to create Binding.php inside my module's root, like this: src/custom/Espo/Modules/{MODULE_NAME}/Binding.php

    Inside of this Binding class, I have changed the namespace but overall copied what is in the documentation, thrown out what I (think) don't need and only kept this inside my process method:

    PHP Code:
    $binder ->bindService('Espo\\Modules\\{MODULE_NAME}\\Tools\\GlobalSearch\\Service''globalSearchService'); 
    Obviously the files are present, so I have assumed that this will automagically work, but again, I am not awfully familiar with how DI is implemented, can you elaborate on how to actually achieve what is mentioned in the old post linked above, that is implementing the custom service to override global search service? What am I missing here?

    Just a disclaimer, I do not intend to waste your time in any way, it might be a skill issue on my part, but please have patience

    Thank you in advance.
    ​​
Working...
X