A
A
Anton R.2020-08-28 00:26:05
OOP
Anton R., 2020-08-28 00:26:05

What does this relation of objects mean?

Digging into the Opencart code at the very beginning I see the following expressions:

$registry = new Registry();

// Тут куча разного кода, потом:

// Event
$event = new Event($registry);
$registry->set('event', $event); // То что тут происходит понятно

// Loader
$loader = new Loader($registry);
$registry->set('load', $loader); // Здесь тоже


What does it mean when the registry object is passed to the constructor of the event and loader objects and then it takes these objects into itself? It looks strange. It is not entirely clear why this is done, in order for the loader object to have access to the entire contents of the registry object in the future?

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