public function newSelection(IdentityObject $obj) { $fields = implode(', ', $obj->getObjectFields()); $core = "SELECT {$fields} FROM area"; list($where, $values) = $this->buildWhere($obj); return array($core . " " . $where, $values); }
public function buildWhere(IdentityObject $obj) { if ($obj->isVoid()) { return array("", array()); } $compstrings = array(); $values = array(); foreach ($obj->getComps() as $comp) { $compstrings[] = "{$comp['name']} {$comp['operator']} ?"; $values[] = $comp['value']; } $where = "WHERE " . implode(" AND ", $compstrings); return array($where, $values); }