Business API invocation service¶
This service is the access point to the Business API and defined by a service with the ID
Because this service acts only as a proxy, the business logic itself is handled by different operation services.
Calling Business API operation service¶
To call Business API operation service, use the
call() method of the Business API invocation service.
The identifier of the Business API operation service consists of two parts separated by a dot.
- The first part is the alias of the operation service that can be found in the configuration:
- The second part is the operation method that should be invoked.
The method name must be lowercase, separated by underscore instead of the method's camelCase notation (
1 2 3
The following example shows how to use the Business API basket operation service.
1 2 3 4 5 6 7 8
Implementing a Business API operation¶
To extend the Business API, you need to create a new service class.
The operations of that class contain the business logic respectively and are stored in
Each operation, e.g. basket, is a service which must be tagged in the following way:
1 2 3 4
name must always be
alias defines the first part in the operation identifier.
Derive your new service from the common parent class
to get access to commonly needed dependencies (e.g. logging and translations).
Overriding an existing Business API class¶
If you want to override a particular API service you need to create a new service class, which extends the original. Within that class you can override individual methods or add new methods. Then you need to redefine the service in the Symfony configuration with the new class and the same tag values (name and alias).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
There are two ways to redefine the service configuration:
If the original service is defined with a configuration parameter (
% notation) in its class attribute,
you need to redefine that parameter with a fully-qualified class name.
The other option is to completely redefine the original service with a new fully-qualified class name.
1 2 3 4