Tengo un archivo config.php
Código PHP:
return array_merge_recursive(array(
'includePaths' => array(
'library' => APPLICATION_PATH . '/library'
),
'bootstrap' => array(
'path' => APPLICATION_PATH . '/Bootstrap.php',
'class' => 'Bootstrap'
),
'autoloaderNamespaces' => array(
'App_'
),
'resources' => array(
'frontController' => array(
'moduleDirectory' => APPLICATION_PATH . '/modules'
//'defaultModule' => 'Default'
),
'modules' => array(),
'router' => array(
'routes' => include dirname(__FILE__) . '/routes.config.php'
),
'view' => array(
'helperPath' => array(
'App_View_Helper_' => APPLICATION_PATH . '/library/App/View/Helper'
)
),
'layout' => array(
'layout' => 'layout',
'layoutPath' => APPLICATION_PATH . '/layouts/scripts'
),
'db' => array(
'adapter' => 'pdo_mysql',
'isDefaultTableAdapter' => true,
'params' => array(
'charset' => 'utf8'
)
)
)
), include dirname(__FILE__) . '/' . APPLICATION_ENV . '.config.php');
Código PHP:
public function loginAction()
{
if ($this->getRequest()->isPost()) {
$result = Default_Service_ServiceAbstract::getService('Default_Service_User')
->login($this->getRequest()->getPost());
echo $result;
}
}
Código PHP:
abstract class Default_Model_Mapper_MapperAbstract
{
protected static $_defaultAdapter;
protected $_adapter;
public function __construct(Zend_Db_Adapter_Abstract $adapter = null) {
if ($adapter === null) {
$adapter = self::getDefaultAdapter();
}
if ($adapter === null) {
$mensaje = 'No adapter was defined';
}
$this->_adapter = $adapter;
$this->_init();
}
public function _init()
{
}
public function getDefaultAdapter()
{
return self::$_defaultAdapter;
}
public static function setDefaultAdapter(Zend_Db_Adapter_Abstract $adapter)
{
self::$_defaultAdapter = $adapter;
}
}
Dice que Call to undefined method Zend_Db_Adapter_Pdo_Mysql::isValid(). library\Zend\Auth.php on line 127
Código PHP:
public function login(array $data)
{
$form = $this->getLoginForm();
$a =1 ;
if (!$form->isValid($data)) {
return false;
}
$this->_mapper ->setIdentity($data['username'])
->setCredential($data['password']);
$usuario = $this->_mapper->setIdentity($data['username']);
$password =$this->_mapper->setCredential($data['password']);
[COLOR="black"]$result = Zend_Auth::getInstance()->authenticate($this->_mapper);[/COLOR]
if (!$result->isValid()) {
switch ($result->getCode()) {
case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
$form->getElement('username')->setErrors(array('Username does not exist'));
break;
case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
$form->getElement('password')->setErrors(array('Password is not valid'));
break;
case Zend_Auth_Result::FAILURE_UNCATEGORIZED:
$form->getElement('username')->setErrors(array('Username was not confirmed yet'));
break;
}
return false;
}
if ($data['remember'] === '1') {
}
return true;
}