i think your controller should be called PostReplies, or you can add this line to call the right model.
var $uses = 'PostReply';
atenciosamente,
Werner Petry Moraes
wernerpm@gmail.com
-- Werner Petry Moraes
wernerpm@gmail.com
On Mon, Aug 22, 2011 at 15:25, Almacenamiento Almacenamiento <almacenamiento1@gmail.com> wrote:
I'm trying to relate the table and Posts_Replies Posts, but I have some problems ..
Check several times tables, file names and code, but I see no objection to that.
Search internet, but I can not fixearlo U.u
Even in the inflector.php adds 'post_reply' => 'posts_replies' x just in case
Q I hope I can help, I'm going crazy!
Undefined property: PostsRepliesController::$PostReply [APP\controllers\posts_replies_controller.php, line 18]
Trying to get property of non-object [APP\controllers\posts_replies_controller.php, line 18]
Fatal error: Call to a member function find() on a non-object in G:\xampp\htdocs\cake\miforo\app\controllers\posts_replies_controller.php on line 18
Table:
*Posts
*Posts_Replies
Controller PostsReplies
<?
class PostsRepliesController extends AppController
{
var $name="PostsReplies";
var $helpers=array("Html", "Form");
//var $scaffold;
function add($id=null)
{
if(!empty($this->data))
{
$this->PostReply->create();
if($this->PostReply->save())
{
$this->Session->setFlash('Respuesta Salvada');
}
}
$posts = $this->PostReply->Post->find('list',
array(
'fields'=>'Post.titulo',
'conditions'=>array('Post.id'=>$id)
)
);
$this->set('posts', $posts);
}
}
?>
Model PostReply
<?
class PostReply extends AppModel
{
var $name="PostReply";
var $belongsTo="Post";
}
?>
Model Post
<?
class Post extends AppModel{
var $name="Post";
var $hasMany="PostReply";
}
?>
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment