A
A
Alexey Nikolaev2018-02-12 17:23:07
PHP
Alexey Nikolaev, 2018-02-12 17:23:07

How is it customary to design objects according to some parameter?

Good evening.
There is an object ID, and a class that characterizes the essence of the object. An instance of the class is created based on this ID (all data about the object, all parameters are filled). There are 2 options:
- do it in the constructor of the entity
- do it in the factory, and add everything to the class from the outside
What is the generally accepted approach if the design logic is complex?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question