How to use Set function inside components in cake php ?
class TestComponent extends Object
{
//etc
$this->set('User', $user);
}
I am getting an error
Fatal error: Call to undefined method TestComponent::set()
How this can be corrected ?
Cake passes the Controller reference to the startup function of a Component. You need to keep a reference in your component to use later in custom functions.
See here http://book.cakephp.org/1.3/en/view/996/Creating-Components#MVC-Class-Access-Within-Components-998