Answer the question
In order to leave comments, you need to log in
OOP: Storing an object in a property of another object?
Such is the task. For example, I have a PDO object. I create it in the constructor of the main class and assign it to a property of this class to access it from other methods of this class. In the future, to pass it to third-party controllers through action arguments, like this: $Obj->actionName($this->MyPdoObj)
Question: am I doing it right?
Answer the question
In order to leave comments, you need to log in
Everything is OK, no set of objects is created, links to the same object are stored.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question