jeudi 29 juin 2017

PHP Design Pattern for modifying Objects

I'm still a beginner when it comes to best practice OOP Patterns in PHP. What im trying to do is modifying the attributes of an object but um not quite sure how to implement it.

To be more specific: I have an 'order' object and the payment for that order is split into two payments, the pre payment and the final Payment. The calculation for each payment is a bit complex so i put the calculation in a seperate class, the 'costumerPaymentCalculator' which needs information from the order object to calculate the payments.

Should i just pass the Order Object to the calculator, modify the attributes within the calculater class and return the Order object?

Aucun commentaire:

Enregistrer un commentaire