Answer the question
In order to leave comments, you need to log in
Application architecture. How to implement an entity-model relationship?
Good afternoon! I lived happily until I found out that the architecture should have a layer of entity classes that describe the subject area. All business logic must operate on these objects (and not data model objects, as I used to). More or less like this:
на входе $id заказа
$orders = new Orders();
$order = new Order();
$order = $orders->get_order_by_id($id); //получаем заказ по id
$order->sum = 100; //меняем сумму заказа на 100
$orders->change_order($order); //изменяем заказ
class Order
{
public $works = array();
public $materials = array();
public $sum;
}
Answer the question
In order to leave comments, you need to log in
Hello.
Load related works and materials entities not immediately, but on demand.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question