###What happened:
Model::find(new MongoId($string)) doesn't work.
This is the Posts Model
{{{
Posts extends \lithium\data\Model {
protected $_meta = array('key' => '_id');
protected $_schema = array(
'_id' => array('type' => 'id'),
);
}
}}}
This is the Comments Model
{{{
Comments extends \lithium\data\Model {
protected $_meta = array('key' => '_id');
protected $_schema = array(
'_id' => array('type' => 'id'),
'post_id' => array('type' => 'id'),
);
}
}}}
If I try find comments using $post->_id it won't work because Model::find doesn't work with MongoId
{{{
$post = Post::find('4d9399a6f41c18bc08000004');
$comments = Comments::all(array('conditions' => array('post_id' => $post->_id)));
// Does not work because $post->_id return a MongoId and Model::find doens't work with MongoId
$comments = Comments::all(array('conditions' => array('post_id' => (string) $post->_id)));
// Now it works but Model::find() shouldn't work with MongoId by itself
}}}
The same happen with:
{{{
$comment = Comments::find('4d9399a6f41c18bc08000004');
$post = Posts::find($comment->post_id);
// Doesn't work because of the same problem
}}}