Im trying to filter the company list by area , in the CompanyMapper, i want to add area condition in this select statement , i tried several method but every thing got error
I truing to achieve result using zf2 Tablegateway in COMPANYMAPPER.
how can i achieve the result to similar below :
Select *
From Companies
where 'id' IN ($this->idsArray)
AND 'locality=localityId'
The result should be companies list filtered by locality id .
and code in the companymapper currently is as given below , how to another condition in to this $select ?
public function fetchCompaniesByArea($companies_found, $area, $limit) {
$this->idsArray=$companies_found;
return $this->hydrate(
$this->select(function (Select $select) {
$select->where->in('id', $this->idsArray);
}));
}
You can add one more where condition.
return $this->hydrate($this->select( function (Select $select) {
$select->where->in('id', $this->idsArray); //Like this $select->where('locality=localityId');
}) );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.