Here is my function, when I call it the following error occurs:
Since this object was created with a table and/or schema in the constructor, it is read only
public function getImpressionLeft($AvailableCampaigns){
$result = $this->tableGateway->select(function(Select $select) use ($AvailableCampaigns){
$select->from(array('a'=>'CampaignSettings'));
$select->columns(array(
'a.CampaignID',
'MaxImpression'=>new \Zend\Db\Sql\Expression('a.MaxImpression - b.TotalImpression'),
'MaxClick'=> new \Zend\Db\Sql\Expression('a.MaxClick - b.TotalClicks'),
))->join(array('b'=>'ImpressionCount'),'a.CampaignID = b.CampaignID',Select::JOIN_LEFT)
->where(new \Zend\Db\Sql\Predicate\In('a.CampaignID',$AvailableCampaigns));
});
return $result->getDataSource();
}