There are two modules A and B. to modify the content in the database of module A, the data of module B should be modified together. module A can also read some data of module B. How can we minimize the coupling between modules? There are two modules A and B. to modify the content in the database of module A, the data of module B should be modified together. module A can also read some data of module B.
How can we minimize the coupling between modules?
Reply content:
There are two modules A and B. to modify the content in the database of module A, the data of module B should be modified together. module A can also read some data of module B.
How can we minimize the coupling between modules?
Take Customer as A and Order as B. In this example, the value in B is modified.
$ Customer = Customer: findOne (123 );
$ Order = new Order ();
$ Order-> subtotal = 100;
//...
// Setting the attribute that defines the "customer" relation in Order
$ Order-> customer_id = $ customer-> id;
$ Order-> save ();
Add a service layer to process the business logic.
There will be no problem with your cross-module call. Because the services layer has nothing to do with the module.