Replace  with ->getRequest()->isPost()