SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot beeXtreem's Avatar
    Join Date
    Jan 2006
    Location
    Nigeria
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Zend Framework problem

    I keep getting the following error:
    Code:
    Catchable fatal error: Object of class stdClass could not be converted to string in C:\wamp\www\application\models\Users.php on line 29
    AuthController contains to following extract
    PHP Code:
    class AuthController extends Zend_Controller_Action
    {
      public function 
    loginAction()
      {
            
    //check if logged in b4 displaying login form. go home if logged in
            
    if (Auth::_getLoggedIn())
        {
            
    Common::go_home();
        }
    //if (Auth::_getLoggedIn())
      
    }

    Model Auth has the following extract:
    PHP Code:
    require_once 'models/Users.php';
    class 
    Auth extends Zend_Db_Table_Abstract
    {
      public function 
    _getLoggedIn($acl)
      {
            
    $auth Zend_Auth::getInstance();
        
    $loginId $auth->getIdentity();
        
    $native_user Auth::fetchUserByLoginId($loginId);
      }

      static function 
    fetchUserByLoginId($loginId)
      {
            
    $user = new Users();
            return 
    $user->fetchUserDataByLoginId($loginId);
      }
    //static function fetchUserByLoginId($loginId)

    Model Users contains:
    PHP Code:
    class Users extends Zend_Db_Table_Abstract
    {
       protected 
    $_name 'users';
       protected 
    $_rowClass 'User';
       public function 
    fetchUserDataByLoginId($loginId)
       {
        
    $row $this->fetchRow("loginId = '$loginId'");
            return 
    $row;
        }
    //public function fetchUserDataByLoginId($loginId)

    when I try to view auth/login I get the error I stated above. What could be the problem and how do I stop it.
    JC Rocks!!

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    loginId is not a string, it is an object.

    use var_dump() on it.

  3. #3
    SitePoint Zealot beeXtreem's Avatar
    Join Date
    Jan 2006
    Location
    Nigeria
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, I'll look into it.
    JC Rocks!!

  4. #4
    SitePoint Zealot beeXtreem's Avatar
    Join Date
    Jan 2006
    Location
    Nigeria
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works!! thanks a lot crmalibu
    JC Rocks!!

  5. #5
    SitePoint Zealot beeXtreem's Avatar
    Join Date
    Jan 2006
    Location
    Nigeria
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry but, I've hit another snag. this time, there is no display at all. I've traced the fault to the fetchRow function in the code below.

    PHP Code:
    class Users extends Zend_Db_Table_Abstract
    {
       protected 
    $_name 'users';

       protected 
    $_rowClass 'User';
       public function 
    fetchUserDataByLoginId($loginId)
       {
        
    $row $this->fetchRow("loginId = '$loginId'");
            return 
    $row;
        }
    //public function fetchUserDataByLoginId($loginId)


    I located the fetchRow function:
    [PHP]sorry but, I've hit another snag. this time, there is no display at all. I've traced the fault to this function.

    PHP Code:
    public function fetchRow($where null$order null)
        {
            
    $keys    array_values((array) $this->_primary);
            
    $vals    array_fill(0count($keys), null);
            
    $primary array_combine($keys$vals);

            
    $rows $this->_fetch($where$order1);

            if (
    count($rows) == 0) {
                return 
    null;
            }

            
    $data = array(
                
    'table'   => $this,
                
    'data'    => $rows[0],
                
    'stored'  => true
            
    );

            
    Zend_Loader::loadClass($this->_rowClass);
            return new 
    $this->_rowClass($data);
        } 
    going through the fetchRow function (which is a ZF function), I traced the fault to this line:

    PHP Code:
    Zend_Loader::loadClass($this->_rowClass); 
    every thing showed up as ok till that point. beyond it, nothing executes. No errors showed up in my apache and php error logs.

    PLease help. what could be wrong?
    JC Rocks!!

  6. #6
    SitePoint Zealot beeXtreem's Avatar
    Join Date
    Jan 2006
    Location
    Nigeria
    Posts
    128
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no worries, I've sorted it vout. thanks
    JC Rocks!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •