Hi,
I'm getting this error playing around with Authentication
The supplied parameters to DbTable failed to produce a valid sql statement,
please check table and column names for validity.
the code 
global.php
return array(
    'db' => array(
        'driver'         => 'Pdo',
        'dsn'            => 'mysql:dbname=album;host=localhost',
        'driver_options' => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'Zend\Db\Adapter\Adapter'
                    => 'Zend\Db\Adapter\AdapterServiceFactory',
        ),
    ),
);
Moule.php
 public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'Auth\Model\User' =>  function($sm) {
                    $tableGateway = $sm->get('UserTableGateway');
                    $table = new User($tableGateway);
                    return $table;
                },
                'Auth' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $authAdapter = new AuthAdapter($dbAdapter);
                    $authAdapter
                        ->setTableName('user_auth')
                        ->setIdentityColumn('username')
                        ->setCredentialColumn('password');
                    return $authAdapter;
                },
                'UserTableGateway' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $resultSetPrototype = new ResultSet();
                    $resultSetPrototype->setArrayObjectPrototype(new
RegisterInputFilter());
                    return new TableGateway('user_auth', $dbAdapter, null,
$resultSetPrototype);
                }
            ),
        );
    }
AuthController.php
public function loginAction()
    {
        $sm = $this->getServiceLocator();
        $authAdapter = $sm->get('Auth');
        $form = new Login('frm-sign-in');
        $form->get('submit')->setValue('Login');
        $request = $this->getRequest();
        if ($request->isPost()) {
            $filter = new LoginInputFilter();
            $form->setInputFilter($filter->getInputFilter());
            $form->setData($request->getPost());
            
            if ($form->isValid()) {
                $filter->exchangeArray($form->getData());
                $authAdapter
                    ->setIdentity($filter->username)
                    ->setCredential($filter->password);
                
               $result = $authAdapter->authenticate();
               //if($result->isValid()){}
               \Zend\Debug\Debug::dump($result->isValid());
              
\Zend\Debug\Debug::dump($authAdapter->getResultRowObject(null,'password'));
            }
        }
     //   \Zend\Debug\Debug::dump($this->getEvent()->getResult());
        return array('form' => $form);
    }

Can anyone point me out whare I'm wrong,please ?




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/zend-2-Authentication-The-supplied-parameters-to-DbTable-failed-to-produce-a-valid-sql-statement-tp4659161.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to