There is a Database class to work with database. Still have a Session class for sessions. In the class session has database queries, and the queries are done through the Database class. How to make visible the Database class methods in the class Session?
Nothing but to use $GLOBALS in the designer, I figured it out. Prompt how generally to implement it?
$Database = new Database;
$Session = new Session;
And actually what I use in the constructor of the class Session:
public function __construct()
$this->Database = isset($GLOBALS['Database']) ? $GLOBALS['Database'] : new Database;
It works, but the appropriateness of such a decision?