Saturday, September 13, 2014

Fatal Error: Call to a member function schema() on a non-object

I have some trouble finding a solution for this..

Error: Call to a member function schema() on a non-object  File: /Cake/Model/Model.php  Line: 3627

In my Database there are the tables articles,hashtags and the association articles_hashtags with the foreignkeys article_id and hashtag_id .. So i am trying to get the information what hashtags each article has..

My Article Model

class Article extends AppModel {
public $hasAndBelongsToMany = array(
'Hashtag' => array(
'className' => 'Hashtag',
'joinTable' => 'articles_hashtags',
'foreignKey' => 'article_id',
'associationForeignKey' => 'hashtag_id'
) ); }

Article Controller

class ArticleController extends AppController {
public $helpers = array("Html", "Form");
public function index() {
$this
->set("posts", $this->Article->find("all")); } }



Thanks for your help!!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: