title: Trouble accessing $this in controller method
body: <p>I'm building an API via Slim, and using class based controller methods. Looking at the <a href="https://www.slimframework.com/docs/objects/router.html" rel="nofollow noreferrer">router docs</a> (under "Allow Slim to instantiate the controller"), it seems like the DI should insert the <code>ContainerInterface</code> into the class constructor, and then I should be able to access <code>$this-&gt;container</code> in the class method to access the container.</p>
  
  <p>I created a base class:</p>
  
  <pre><code>class BaseController
  {
  
      protected $container;
  
      public function __construct(\Interop\Container\ContainerInterface $container) {
          $this-&gt;container = $container;
      }
  
  }
  </code></pre>
  
  <p>And then tried this:</p>
  
  <pre><code>class PMsController extends BaseController
  {
  
      public function index(Request $request, Response $response, $args)
      {
          var_dump($this); exit;
      }
  
  }
  </code></pre>
  
  <p>And my route:</p>
  
  <pre><code>$app-&gt;group('/pms', function () {
      $this-&gt;get('', '\App\Controllers\PMsController::index');
  })-&gt;add(authMiddlware());
  </code></pre>
  
  <p>But I get the error: <code>Using $this when not in object context</code>. I have no idea how that gets there, when it's a class method. I'm not positive if I should be using another method of accessing the container?</p>