Hi All,
I have started to work with the Zend Framework 2.0.5. In which, all database operation performed through stored procedure. At a time of user login, I am validating user email address. For that, I have added one method in service file and created required procedure as follows,
User Controller :
$result = $this->getUserService()->validateUser($_REQUEST);
File : zf2_tutorial\module\ZfcUser\src\ZfcUser\Service\User.php
/* $data is the user provided login email address */
public function validateUser(array $data)
{
$results = $this->dbAdapter->query("CALL userlogin(".$data['identity'].")", Adapter::QUERY_MODE_EXECUTE);
$row = $results->current();
print_r($row,1);
}
Stored Procedure :
DELIMITER $$
USE `zf2_tutorial`$$
DROP PROCEDURE IF EXISTS `userlogin`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `userlogin`(IN email1 VARCHAR(255))
BEGIN
SELECT * FROM USER WHERE email=email1;
END$$
DELIMITER ;
Please share your views if I am missing or used any wrong syntax.
Thanks,
Ankit Shah.

