title: Having PDO::fetch(PDO::FETCH_CLASS) return a null-valued instance of the object instead of a bool(false)
body: <p>My users manage the clients of the company via a web interface. They can navigate to clients using (amongst otherways) an input to directly choose a client id, which will show them the client entry.</p>
  
  <p>To do that, I use PDO::FETCH_CLASS to map database values in php objects. Those objects are then used to generate html; said html will be displayed to the screen as the client id.</p>
  
  <pre><code>$oSTMT = $oDB-&gt;prepare("SELECT id,name FROM clients WHERE id=?");
  $oSTMT-&gt;setFetchMode(PDO::FETCH_CLASS,'client');
  $oSTMT-&gt;execute(array(12673));
  $oClient = $oSTMT-&gt;fetch(); // returns false when no row is selected
  $oClient-&gt;makeHTML(); // which resultd in Fatal error: Call to a member function on a non-object
  </code></pre>
  
  <p>before redesigning to have an object wrap the fetched object so that it won't break if it is a boolean, I would try to have PDO generate an instanced object anyway.</p>
  
  <p>My problem is twofold: entering a non-existent client id in the input and creating a new client. In both case the client id refers to no line in the database; <code>execute(array([values])</code> will return <code>bool(true)</code> (the statement executed sucessfully) but the <code>-&gt;fetch(PDO::FETCH_CLASS,'client')</code> will return a <code>bool(false)</code></p>
  
  <p>my solution is to create a client row with id=0 so that when it does not exists, I query with id=0 instead to get my "default" client row, but I was wondering:</p>
  
  <p><strong>Is there a command to instruct <code>PDO::FETCH_CLASS</code> to generate an instance of selected object when no rows are selected by the statement?</strong></p>
  
  <p>this would also prevent me from having to first verify if the id exists (which is not that costly, I'll admit, but I'd like not to have to)</p>