AnsweredAssumed Answered

What is the best practice for extending native classes in Sugar 7

Question asked by philipzaengle philipzaengle on Apr 1, 2014
Latest reply on Apr 1, 2014 by philipzaengle philipzaengle
What's the best way to extend core Sugar classes; as an example the SugarApi class.

Typically when creating a  new API endpoint the following works just fine:

class NewEndpointApi extends SugarApi{
   // custom code here
However many of the custom endpoint I'm creating share common methods. I'd rather not replicate those methods between endpoint classes. I'd like to be able to do something like this:

class BaseApi extends SugarApi{
   // custome code here
class NewEndpointApi extends BaseApi{
   // custome code here

Here are my questions:
1) What's the best place to store a custom class like this, maybe custom/include?
2) Do I need to register the BaseApi class with sugar?
3) Is there a better way to do this entirely?