Well I went ahead and worked around it.
I created a class Model_Base
class Model_Base extends ORM
{
public function Load()
{
foreach($this->object() as $key => $value)
if(!is_object($value))
if(property_exists(get_class($this), $key))
$this->$key = $value;
}
}
Now I extend all my models from here
class Model_Job extends Model_Base
{
..................
}
And now my controller uses this:
public function action_view()
{
$this->render('Shit');
$this->template->content = View::factory('jobs/job')
->bind('job', $job);
$job = ORM::factory('job', $this->request->param('id'));
$job->Load();
}
And it dumps:
object Model_Job(39) {
protected _primary_key => string(2) "ID"
public ID => string(1) "1"
public user_ID => string(1) "1"
public title => string(14) "Testbaantjeeee"
......................
}
I still think it makes no sense. But whatever. If anyone knows why they made find()/factory('foo', $id)
and find_all()
so fundamentally different that the former is useless, let me know :)