I have these tables:
table: CREATORS
obs.:I've also tried that way:
table: POSTS
CreatorModel.php
class CreatorModel extends AppModel {
public $actsAs = array('Containable');
public $hasOne = array('Post');
}
PostModel.php
class PostModel extends AppModel {
public $actsAs = array('Containable');
public $hasOne = array('Creator');
}
IndexController.php
$this->set('posts', $this->Post->find());
index.ctp
var_dump($posts);
Following the CakeBook session about Associations http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
I should receive that response in view:
Array
(
[Post] => Array
(
[id] => 1
[creator_id] => 1
[tags] =>
[title] => Teste
[post] => Maromba
[created] => 2013-04-29 19:14:32
[modified] => 2013-04-29 19:14:32
)
[Creator] => Array
(
[creator_id] => 1
[creator] => Alexandre Moraes
)
)
But i receive this:
Array
(
[Post] => Array
(
[id] => 1
[creator_id] => 1
[tags] =>
[title] => Teste
[post] => Maromba
[created] => 2013-04-29 19:14:32
[modified] => 2013-04-29 19:14:32
)
)
So, any ideas what i'm doing wrong?