Apply for Zend Framework Certification Training

Zend Framework 2

In Model file 

    you need to include
       $sql = $this->tableGateway->getSql();
   and to print the query 
       echo $sql->getSqlstringForSqlObject($sqlSelect); die ;
namespace Application\Model;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql\Where;
class HotelTable
	protected $tableGateway;
	public function __construct(TableGateway $tableGateway)
	public function fetchAll()
		$sql = $this->tableGateway->getSql();
		$sqlSelect = $this->tableGateway->getSql()->select();
		$sqlSelect->join('employee', ' = hotel.hotelId', array(), 'inner');
		echo $sql->getSqlstringForSqlObject($sqlSelect); die ;
		$resultSet= $this->tableGateway->selectWith($sqlSelect);
		return $resultSet;

< Login And Logout in Zend Framework 2 Last >

Ask a question

  • Question:
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question

Back to Top