How to address Entry Points with the same name but at different namespaces

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    How to address Entry Points with the same name but at different namespaces

    Could somebody explain how Espo routes calls to custom Entry Point classes when they are in a different namespace than Espo\Custom ?

    So far I have noticed that as long as an Entry Point class name is unique, Espo checks Espo\Modules and Espo\Custom namespaces for the class without a problem, so I can call for the Entry Point from a front end script like this:

    var url = '?entryPoint=sqlDataDispatcher';

    regardless of where is the SqlDataDispatcher entry point class located, because its name is unique, but how can I address an Entry Point class that has a name that is not unique and is located at a specific namespace ?

    for example: assume that I have two different SqlDataDispatcher entry point classes, one located at Espo\Modules\Module1 and the other one located at Espo\Modules\Module2, how could I define var url in my script for entry point "SqlDataDispatcher" that is located at the Espo\Modules\Module2 namespace ?

    Thanks in advance for your help
    Last edited by telecastg; 01-28-2020, 07:57 PM.
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hello Telecastg,
    it's last time i say "my skill is not ..."
    but i have make a custom entryPoint (pdf) .. so i can make custom pdf ... but it's my 2cents idea :
    PHP Code:
    
    if (empty($_GET['entityId']) || empty($_GET['entityType']) || empty($_GET['templateId'])) {
                throw new BadRequest();
            } 
    
    you can have the entityType, entityId... so you can make all
    i don't understand "namespace"

    Regards

    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • telecastg
      Active Community Member
      • Jun 2018
      • 907

      #3
      Hello item I was talking about this section of the class definition scripts, namespace it is where you tell PHP where is the class located:

      PHP Code:
      
      namespace Espo\Custom\EntryPoints;
      
      use \Espo\Core\Exceptions\NotFound;
      use \Espo\Core\Exceptions\Forbidden;
      use \Espo\Core\Exceptions\BadRequest;
      
      class DataDispatcher extends \Espo\Core\EntryPoints\Base
      {
       bla bla bla... 
      
      If I want to call this entry point from a javascript view to execute an Ajax call I can write: var url = '?entryPoint=dataDispatcher'; and Espo will find it no matter in which namespace is located as long as "DataDispatcher" is a unique entry point name, but if I had two different classes, both named "DataDispatcher" but located at different namespaces, how would I be able to call each from a javascript view ?

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        > that has a name that is not unique and is located at a specific namespace

        This is not supported.
        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

        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #5
          Thanks so much yuri

          Comment

          Working...