$this->model = Doctrine::getTable('Model');
$model = $this->model->find(1);
var_dump($model->id);
// returns: string '1' (length=1)
var_dump($model->toArray());
// returns: array
// 'id' => null
// ...
Why does that happen?
Ok, just found out, it has to do with the __construct() in my model.
I take that out, I get an id in my array.
So I guess my next question would be, how can I use __construct() and still use the toArray() function?
(Oh, and yes, of course, am calling the parent::__construct()…)
I found the answer to my own question.
You have to pass a new instance of Doctrine_Table to the Doctrine_Record __construct() method.
Even after I found the answer, I couldnt find it online, so I am leaving this here, in case someone else needs it.