Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Primary key problems
  • hello all! I have this model inside a module
    namespace blog;
    
    class Model_Post extends \Orm\Model
    {
        protected static $_primary_key = array('vid');
        protected static $_properties = array('vid', 'onto_id', 'created','summary','content','related_links','author_id');
        protected static $_table_name = 'onto_post';
     }
    

    and from my controller I do this:
    $posts = Model_Post::find()
     ->order_by('created', 'desc')
     ->limit(10)
     ->get();
    

    I get this error
    OutOfBoundsException [ Error ]: Property "id" not found for blog\Model_Post.
    PKGPATH/orm/classes/model.php @ line 807
    
  • Could you post the full backtrace from the error message?
  • of course :) OutOfBoundsException [ Error ]: Property "id" not found for blog\Model_Post.
    PKGPATH/orm/classes/model.php @ line 807
    802            }
    803            return $this->_data_relations[$property];
    804        }
    805        else
    806        {
    807            throw new \OutOfBoundsException('Property "'.$property.'" not found for '.get_called_class().'.');
    808        }
    809    }
    810
    811    /**
    812     * Set
    
    

    Backtrace PKGPATH/orm/classes/model.php @ line 723
    APPPATH/modules/blog/views/index.php @ line 2
    COREPATH/classes/view.php @ line 243
    COREPATH/classes/view.php @ line 257
    COREPATH/classes/view.php @ line 548
    COREPATH/classes/view.php @ line 211
    APPPATH/views/template.php @ line 52
    COREPATH/classes/view.php @ line 243
    COREPATH/classes/view.php @ line 257
    COREPATH/classes/view.php @ line 548
    COREPATH/classes/view.php @ line 211
    DOCROOT/index.php @ line 61
  • OMG. terribly sorry, my mistake :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion