title: should generic super class for model be static and singleton?
body: <p>status: accepting the only one answer choice. with thanks.</p>
  
  <p>shouldn't I use static functions and <code>self::</code> instead of <code>$this-&gt;</code>   in here . I would use this class Dao as a <code>super class</code> in all of my model classes. </p>
  
  <p>The Dao class will be the super class of all the <code>model classes.</code></p>
  
  <p>Should it be singleton? should it use static?</p>
  
  <p>any tips ?</p>
  
  <pre><code>&lt;?php 
  class Dao extends Object{
      private $con;
      //will put this in defines includes file. Or user from WP.
      private $dbhost     = "localhost";
      private $dbname     = "wpm";
      private $dbuser     = "root";
      private $dbpass     = "root";
  
      public function __construct() {
         if(!$this-&gt;con){
             $this-&gt;con = new PDO("mysql:host=$this-&gt;dbhost;dbname=$this-&gt;dbname",$this-&gt;dbuser,$this-&gt;dbpass); //will make it generic. 
         }
      }
  
      protected function getCon(){
          if(!$this-&gt;con){
             $this-&gt;con = new PDO("mysql:host=$this-&gt;dbhost;dbname=$this-&gt;dbname",$this-&gt;dbuser,$this-&gt;dbpass);
          } 
          return $this-&gt;con;
      }
  
      protected function executeQuery($query, $fetchType, $paramArray){
          $stmt = $this-&gt;getCon()-&gt;geprepare($query);
          $stmt-&gt;execute($paramArray);
          $stmt-&gt;setFetchMode($fetchType);//        $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);
          $result = $stmt-&gt;fetch();
          return $result;
      } 
  
  }
  
  ?&gt;
  </code></pre>