result to PDO::FETCH_CLASS PDO stored procedure
<p>I am trying to map a stored procedure result to an object</p>

<p>Can anyone let me know what i am doing wrong.</p>

<p>The stored procudure is simple select id from image;   </p>

<p>no exeception just hangs around $result = $stmt->execute(PDO::FETCH_CLASS, 'A');</p>

<pre><code>try {
                $pdo = new PDO($db, $u, $p);
                $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $stmt = $pdo-&gt;prepare('CALL get_associated_image_detail(                    
                    @in_image_alias_title=:in_image_alias_title,
                    @in_image_visible=:in_image_visible,
                    @in_image_approved=:in_image_approved,
                    @in_album_visible=:in_album_visible,
                    @in_album_approved=:in_album_approved)');

                $stmt-&gt;bindParam(":in_image_alias_title",$alias_title,PDO::PARAM_STR);  
                $stmt-&gt;bindValue(":in_image_visible",'1',PDO::PARAM_STR);  
                $stmt-&gt;bindValue(":in_image_approved",'Yes',PDO::PARAM_STR);  
                $stmt-&gt;bindValue(":in_album_visible",'1',PDO::PARAM_STR);  
                $stmt-&gt;bindValue(":in_album_approved",'Yes',PDO::PARAM_STR); 
               $result = $stmt-&gt;execute(PDO::FETCH_CLASS, 'A');
 while($user = $result-&gt;fetch()) {
                    # Call our custom full_name method
                    echo $user-&gt;id();
                }
            }
             catch (Exception $e)
            {                    // apologise
                    echo '&lt;p class="error"&gt;Oops, we have encountered a problem, but we will deal with it. Promised.&lt;/p&gt;';
                    // notify admin
                    send_error_mail($e-&gt;getMessage());
            }


class A{

    function __construct($params = array()) {

    if (empty($params['id'])) $this-&gt;id = NULL;

  }

     public $id;

  public function id()
  {
    return $this-&gt;id;
  }
}
</code></pre>
