V
V
vitaly_742017-11-26 23:27:37
PHP
vitaly_74, 2017-11-26 23:27:37

Don't know how to encapsulate db connection?

How can I encapsulate the connection to the database? those. move it above the rest of the classes.
and already in the work of other classes to use this connection. and not to produce the sea, yes, I know the singleton pattern is eating, but I still don’t understand it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
McBernar, 2017-11-26
@vitaly_74

Encapsulation is to hide inside, not to take out.
What's wrong with singleton?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question