Não sei onde possa estar o erro. Poderiam me ajudar
Notice: Undefined variable: this in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php on line 18
Notice: Trying to get property 'request' of non-object in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php on line 18
Warning: Use of undefined constant - assumed '' (this will throw an Error in a future version of PHP) in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php on line 18
Warning: A non-numeric value encountered in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php on line 18
Fatal error: Uncaught Error: Call to undefined function Estoque\Controller\getPost() in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php:18 Stack trace: #0 C:\sistemas\Estoque\Skeleton-Application\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(82): Estoque\Controller\UsuarioController->loginAction() #1 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) #2 C:\sistemas\Estoque\Skeleton-Application\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #3 C:\sistemas\Estoque\Skeleton-Application\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #4 C:\sistemas\Estoque\Skeleton-Application\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractContro in C:\sistemas\Estoque\Skeleton-Application\module\Estoque\src\Estoque\Controller\UsuarioController.php on line 18
=============================
Segue codigo
UsuárioController.php
<?php
namespace Estoque\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class UsuarioController extends AbstractActionController{
public function indexAction(){
return new ViewModel();
}
public function loginAction(){
if($this->request->isPost()){
$dados = $this->request->getPost(); ==========> linha 18 do erro
$authService = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
$authAdapter = $authService->getAdapter();
$authAdapter->setIdentityValue($dados['email']);
$authAdapter->setCredentialValue($dados['senha']);
$authResult = $authService->authenticate();
if($authResult->isValid()) {
return $this->redirect()->toUrl('/Produto/cadastrar');
}
$this->flashMessenger()->addErrorMessage("Login ou senha inválidos");
return $this->redirect()->toUrl('/Usuario/index');
}else{
return $this->redirect()->toUrl('/Usuario/index');
}
}
}
?>
======================= module.config.php
'authentication' => array(
'orm_default' => array (
'object_manager' => 'Doctrine\ORM\EntityManager',
'identity_class' => 'Estoque\Entity\Usuario',
'identity_property' => 'email',
'credential_property' => 'senha',
),
),
===================== Module.php
public function getServiceConfig() {
return array(
'factories' => array(
'Zend\Authentication\AuthenticationService' => function($serviceManager) {
return $serviceManager->get('doctrine.authenticationservice.orm_default');
}
)
);
}