Where do you place your custom entry point definit

2019-08-02 08:58发布

问题:

I add all my custom entrypoints in this file: \custom\Extension\application\Ext\EntryPointRegistry\customEntryPoint.php

Is there a better way or place to handle this?

回答1:

Your location is the recommended location as per the 6.5 documentation. All of the files within custom/Extension/application/Ext/EntryPointRegistry/ are compiled into the file custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php when a Quick Repair and Rebuild is done.

As you've tagged this with SuiteCRM, I assume you're using their fork of the 6.5 CE. However, if you want to use your code with later versions (7.7+) of SugarCRM, take note that they have noted their intention to deprecate Entry Points in the near future in favour of extending "Endpoints" for their REST API (v10).



回答2:

That is the best way to handle your custom entry points.



回答3:

There are two best-practice options that utilize the Extension framework in SugarCRM 6.x. Which to use depends on the use of the entry point. The entry point you've specified is best general-purpose, application-wide entry points.

  • File Location: custom/Extension/application/Ext/EntryPointRegistry/customEntryPoint.php

  • Provides for an entry point URL like index.php?entryPoint=customEntryPoint

If instead you find that an entry point could be more focused to a single Sugar module, you can make it module-specific. An example use case might be creating a webhook-type functionality to allow a third party payment service to interact directly with a custom Invoice module. The advantage here is organization; custom code placement is as specific and granular as possible.

  • File Location: custom/Extension/modules/abc_InvoiceModule/Ext/EntryPointRegistry/third_party_webhook.php
  • Provides for an entry point URL like index.php?module=abc_InvoiceModule&entryPoint=third_party_webhook