title: setFetchMode to type Class using namespaces in PHP
body: <p>I'm trying to populate some variables in a PHP class by using setFetchMode and FETCH_CLASS.</p>
  
  <pre><code>&lt;?php # index.php
  use myproject\user\User;
  use myproject\page\Page;
  
  $q = 'SELECT * FROM t';
  $r = $pdo-&gt;query($q);
  
    // Set the fetch mode:
    $r-&gt;setFetchMode(PDO::FETCH_CLASS, 'Page');
  
   // Records will be fetched in the view:
   include('views/index.html');
  ?&gt;
  </code></pre>
  
  <p>In my view file, I have:</p>
  
  <pre><code>&lt;?php # index.html
  // Fetch the results and display them:
  while ($page = $r-&gt;fetch()) {
  echo "&lt;article&gt;
  &lt;h1&gt;&lt;span&gt;{$page-&gt;getDateAdded()}&lt;/span&gt;{$page-&gt;getTitle()}&lt;/h1&gt;
  &lt;p&gt;{$page-&gt;getIntro()}&lt;/p&gt;
  &lt;p&gt;&lt;a href=\"page.php?id={$page-&gt;getId()}\"&gt;read more here...&lt;/a&gt;&lt;/p&gt;
  &lt;/article&gt;
  ";
  }
  ?&gt;
  </code></pre>
  
  <p>These methods are from Class: Page.php:</p>
  
  <pre><code>&lt;?php # Page.php
  function getCreatorId() {
   return $this-&gt;creatorId;
  }
  function getTitle() {
   return $this-&gt;title;
  }
  function getContent() {
   return $this-&gt;content;
  }
  function getDateAdded() {
   return $this-&gt;dateAdded;
  }
  ?&gt;
  </code></pre>
  
  <p>It's pretty straightforward when using standard classes, that is, I've had it all working fine; name-spaces seem problematic however.</p>
  
  <p>For example if I use:</p>
  
  <pre><code>&lt;?php # index.php
  require('Page.php'); // Page class
  $r-&gt;setFetchMode(PDO::FETCH_CLASS, 'Page'); // works
  ?&gt;
  </code></pre>
  
  <p>But when using namespaces,</p>
  
  <pre><code>&lt;?php # index.php
  use myproject\page\Page;
  ?&gt;
  // Set the fetch mode:
  $r-&gt;setFetchMode(PDO::FETCH_CLASS, 'Page'); // problem
  
  // Records will be fetched in the view:
  include('views/index.html');
  ?&gt;
  </code></pre>
  
  <p>Browse to index.php and the browser reports:</p>
  
  <p>Fatal error: Call to a member function getDateAdded() on a non-object in /var/www/PHP/firstEclipse/views/index.html on line 5</p>
  
  <p>My namespace paths are all set-up correctly, as I've successfully instantiated objects using the above naming conventions, for example:</p>
  
  <pre><code>&lt;?php # index.php
  
  use myproject\page\User; # class: /myproject/page/user/User.php
  $b = new User();
  print $b-&gt;foo(); // hello
  ?&gt;
  </code></pre>