Description
I would like to discuss about the subject of combining several OroPlatform applications into one application. After quickly discussing this in #775 with @mbessolov & @alexandr-parkhomenko and also with @24198 from Marello, I may have a different method about how bridges are built from what Oro and Marello do. I think it could be good to explain it and my experiences based on use cases and working projects. What I am proposing does not prevent from building things the way they were built until now, it brings a new way to declare interactions in the Oro Stack.
How things are working nowadays
In OroPlatform, several bricks can collaborate to build an application as a whole. To keep things simple, let's use a concrete example I voluntarily restrict : OroCommerce and Marello.
On both sides we have a bundle responsible for product data : OroProductBundle
and MarelloProductBundle
. None of both inherit of the other (as would do an EE bundle with its CE siamese twin), there is no dependency between the two bundles.
To make those bundles speak to each other, common usage from Oro is to build another bundle, a bridge bundle, knowing how to speak to both sides. It exists in OroCRM and OroCommerce (eg. OroCalendarCommerceBridgeBundle
and OroCalendarCRMBridgeBundle
to connect both sides to OroCalendarBundle
).
Existing use cases (OroCRM and OroCommerce) does not make usage of soft dependencies, everything is bundled and mandatory.
Where I want to drive my argumentation is about what Marello (and other apps) is going to become: OroPlatform applications that can live by itself, which can also be integrated into a larger application (DiamanteDesk has not been integrated this way, Akeneo is not an OroPlatform application anymore and Timelap is an OroCRM plugin and can't live by itself).
Where soft dependencies and bridge bundles can help
Let's say we have OroCommerce and Marello installed in a common application (an use case we are having right now). We would have the composer.json
requiring oro/crm
, oro/commerce
and marellocommerce/marello
, nothing else should be required. All three applications would require oro/platform
and related dependencies they require independently (at the same version).
If we reduce our concerns to customers, here are the bundles in action:
OroAccountBundle
(fromoro/crm
)MarelloSalesBundle
(frommarellocomerce/marello
)
We would like to make available accounts from CRM in Marello's sales order workflow and products, this is the logical union between both tools. Logical move would be to build this bridge bundle:
MarelloOroCustomerBridgeBundle
Where oro/platform
's PR #775 takes action is in the declaration of the bridge bundle yaml file, in Resouces/config/oro/bundles.yml
:
bundles:
- name: Marello\Bridge\OroCustomerBridge\MarelloOroCustomerBridgeBundle
dependencies:
- Marello\Bundle\CustomerBundle\MarelloCustomerBundle
- Oro\Bundle\CustomerBundle\OroCustomerBundle
If PR #775 is merged, the whole source code (including bridges) could be stored in the same repository the app is (eg. for Marello in src/Marello/Bridge/
) and the bridge bundles would not be loaded in the kernel unless OroCRM is present in the application.
What can do a bridge, and actually not fully documented (where the things happens)
A bridge can do lots of things:
- add DB relations between tables of 2 autonomous applications
- add additional form fields (using form extensions)
- add datagrid columns
- add steps to the workflows
- loads of other things I can't think of for today...
We have made some concrete usages of this for internal projects, goals are different from e-commerce, but still matches with what a BAP is.
3 independent applications were linked together:
- a Docker UI
- a project management application
- OroCRM
Bridges are:
- Docker UI -> Project Management (present in Docker UI repository)
- Project Management ->
OroCalendarBundle
(present in Project Management repository) - Project Management ->
OroAccountBundle
(present in Project Management repository) - Project Management ->
OroTaskBundle
(present in Project Management repository)
Below is an example of what can be done:
When the Docker UI is used alone, the "Project" field is not present, the deployment runs and is logged in the Docker UI bundle, the Docker containers are built by docker-compose up
.
When both the Docker UI and the Project Management app are present in the same OroPlatform app, the field appears and DB relations are created, both handled by the bridge bundle.
Same concepts applies to the relation between the Project Management app and OroCRM. This let us build the applications we need, just like a lego brick game.
I hope my explanation is clear, see it as an argument to promote PR #775 feature