Hello everyone,
Im new here and i just started trying to use fuelphp and im trying to use ORM.
In the config ive setted:
'packages' => array(
'orm',
),
The controller:
class Controller_Article extends Controller {
public function action_index()
{
$data = Model_Article::find('all');
echo '<pre>'.$data.'</pre>';
$this->response->body = View::factory('articles/index', $data);
}
}
The model:
class Model_Article extends Orm\Model
{
protected static $_properties = array('id', 'title', 'content', 'date');
protected static $_primary_key = array('id');
protected static $_table_name = 'articles';
}
//Formatting in the editor didn't work for me... OSX Firefox 5.
It's giving me an empty array, i also turned on full logging and the log file is empty.
Am i doing something wrong?
Try this instead: Model_Article::query()->get(), if that does work there's a weird problem.
And if that doesn't work: echo Model_Article::query()->get_query() - it will return a database_query object but when you echo it it will output as an SQL query, which you can check for faults.
SELECT `t0`.`id` AS `t0_c0`, `t0`.`title` AS `t0_c1`, `t0`.`content` AS `t0_c2`, `t0`.`date` AS `t0_c3` FROM `articles` AS `t0`
when i use the query in phpmyadmin it's giving me the results.
So yeah something strange is going on...