public function action_index() { $this->template->title = "simple text title " ; // works fine $this->template->logged_in = true ; // works fine $data['username'] = \Session::get('username') ; // works fine can see it in view $data['users'] = Model_User::find('all') ; // works fine can list them in view with foreach(users as user) $suser = \Session::get('username') ; // this does not seem to work .. gives me this error .. however find all works perfect $data['singleuser'] = Model_User::find()->where('username', $suser ); $view = View::factory('record/index', $data) ; $this->template->content = $view ; }
Harro Verton wrote on Tuesday 28th of June 2011:You're not doing a get(), so it will return a query object, which when assigned to the view, can't be converted to string. See http://fuelphp.com/docs/packages/orm/relations/intro.html#usage
// this works fine now .. $data['suser'] = Model_User::find()->where('username', \Session::get('username') )->get_one(); // but this one works fine as well but don't see the difference with my first one // $data['suser'] = Model_User::find()->where('username', \Session::get('username') ) ; $data['suser'] = Model_User::find('', array('where' => array('username' => \Session::get('username'))));
It looks like you're new here. If you want to get involved, click one of these buttons!