title: How to get controller and action name in zf2
body: <p>in zf1, we can get controller and action name using </p>
  
  <pre><code>$controller = $this-&gt;getRequest()-&gt;getControllerName();
  $action = $this-&gt;getRequest()-&gt;getActionName();
  </code></pre>
  
  <p>How we can achieve this in zf2?</p>
  
  <p>UPDATE:
  I tried to get them using </p>
  
  <pre><code>echo $this-&gt;getEvent()-&gt;getRouteMatch()-&gt;getParam('action', 'NA');
  echo $this-&gt;getEvent()-&gt;getRouteMatch()-&gt;getParam('controller', 'NA');
  </code></pre>
  
  <p>But I am getting error </p>
  
  <pre><code>Fatal error: Call to a member function getParam() on a non-object
  </code></pre>
  
  <p>I like to get them in __construct() method; </p>
  
  <p>Ideally I would like to check if there is no Action is defined it will execute noaction() method. I would check using php method method_exists. </p>