<?php class Controller_admin_dbtest extends Controller_Template { public $template = 'template_backend'; public function action_index() { $articles = Model_Article::find('all'); $data = array(); $this->template->content = View::factory('admin/test', $data); } public function action_404() { $messages = array('Aw, crap!', 'Bloody Hell!', 'Uh Oh!', 'Nope, not here.', 'Huh?'); $data['title'] = $messages[array_rand($messages)]; // Set a HTTP 404 output header $this->response->status = 404; $this->response->body = View::factory('welcome/404', $data); } } ?>
<?php class Model_Article extends Orm\Model { protected static $_properties = array('articleID', 'articleTitle'); protected static $_primary_key = array('articleID'); public function retreiveArticles(){ } } ?>
Jelmer Schreuder wrote on Sunday 8th of May 2011:Are your paths & filenames fully lowercased? (paste those as well, just to check)
ErrorException [ Notice ]: Undefined index: id PKGPATH/orm/classes/query.php @ line 553:552: { 553: if (is_null($obj[$pk])) 554: {
<?php class Controller_Admin_New extends Controller_Template { public $template = 'template_backend'; public function action_index() { $data['articles'] = Model_Article::find('all'); $data['adminUserName'] = "Jeremy Buff"; $data['adminRole'] = "Lead Developer"; $this->template->title = 'Full Sail Times'; $this->template->content = View::factory('admin/new', $data); } public function action_404() { $messages = array('Aw, crap!', 'Bloody Hell!', 'Uh Oh!', 'Nope, not here.', 'Huh?'); $data['title'] = $messages[array_rand($messages)]; // Set a HTTP 404 output header $this->response->status = 404; $this->response->body = View::factory('welcome/404', $data); } } ?>Migration: (migrations/001_create_articles.php)
<?php namespace Fuel\Migrations; class Create_articles { public function up() { \DBUtil::create_table('articles', array( 'articleID' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true), 'articleTitle' => array('constraint' => 65, 'type' => 'varchar'), 'articleExcerpt' => array('constraint' => 350, 'type' => 'varchar'), 'articleBody' => array('type' => 'longtext'), 'startDate' => array('type' => 'datetime'), 'endDate' => array('type' => 'datetime'), 'modDate' => array('type' => 'datetime'), 'authorID' => array('constraint' => 11, 'type' => 'int'), ), array('articleID')); } public function down() { \DBUtil::drop_table('articles'); } }Model: (model/article.php)
<?php class Model_Article extends Orm\Model { } /* End of file article.php */
Jelmer Schreuder wrote on Sunday 8th of May 2011:If your primary key is anything other than "id" you need to set it in your class definition, check the docs.
It looks like you're new here. If you want to get involved, click one of these buttons!