title: PHP: How to get a class member variable from a static method?
body: <p>I am trying to create an abstract <code>Model</code> class that has a static <code>fetchAll</code> method. Subclasses need to specify the name/location that will be used in the <code>fetchAll</code> method. However, I can't figure out how to specify the <code>protected $_name</code> method in a way that is accessible from both the static method and non-static methods. This is what I have so far:</p>
  
  <pre><code>abstract class Model
  {
      protected $_name;
  
      public static function fetchAll()
      {
          $request = new ApiRequest();
          return $request-&gt;get($this-&gt;_name);
      }
  
      public function save()
      {
          $request = new ApiRequest();
          return $request-&gt;put($this-&gt;_name, $this-&gt;_data);
      }
  }
  
  class Email extends Model
  {
      protected $_name = 'zEmailz';
  }
  </code></pre>