The PHP code segment of my component is shown below:
...
class NewsletterFormComponent extends Component {
public $components = ['Flash','RequestHandler'];
public $controller;
public function beforeFilter()
{
$this->controller = $this->getController();
}
public function registration($data = null) {
...
if ($this->request->is('post')) {
//do something
}
...
}
...
The following error is displayed:
Call to a member function is() on null
How to solve this problem?