APPLY FOR ONLINE Zend Framework Certification

                    
                        In Model file 

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


Comment


Back to Top