Possible Duplicate:
PHP: self vs. $this
What does $this-> mean in CakePHP?
Please answer this in two parts…
What does $this refer to?
What does -> refer to?
Can someone explain each part explicitly in terms of the statement $this->Post->find(‘all’); in the Post controller. Why do you need the ->Post part if it is in the Posts controller?
$this refers to the class you want to use. for instance if you see $this->Post->find(‘all’), you’re trying to access the class Post that extends AppModel. Through conventions, the Post Model uses the posts table in your database. $this->Post->find(‘all’) is used because the AppModel has the find() method and the Post model extends AppModel.
http://api.cakephp.org/class/app-model
http://book.cakephp.org/view/22/CakePHP-Conventions