title: PHP OOP MVC Fatal Error: Using $this when not in object context
body: <p>So I've been looking all around, but nothing seems to be relevant to my problem.</p>
  
  <p>I have an MVC, with some controllers and some tools like Session handling.</p>
  
  <p>The session class consists of non-static methods, and in my controller I'm instantiating the session class like this:</p>
  
  <pre><code>public $sessions;
  public function __construct () {
       $this-&gt;sessions = new Session();
  }
  </code></pre>
  
  <p>However, when I call it from a method in the controller, it returns the infamous "Using $this when not in object context". It doesn't make any sense to me.</p>
  
  <pre><code>public function index() {
       $this-&gt;sessions-&gt;get('sessionToGet');
  }
  </code></pre>
  
  <p>This will return the error.</p>