protected function buildSelectStatement(Sql $sql, $finders) { $selectTable = array_keys($finders); foreach ($selectTable as &$ts) { $ts = "{$ts}.*"; } return $sql->select($selectTable); }
protected function buildSelectStatement(Sql $sql, $collections) { $selectTable = array(); foreach ($collections as $tableSpecifier => $c) { if ($this->mixable($c)) { foreach ($this->getMixins($c) as $mixin => $columns) { foreach ($columns as $col) { $selectTable[] = "{$tableSpecifier}_mix{$mixin}.{$col}"; } $selectTable[] = "{$tableSpecifier}_mix{$mixin}." . $this->getStyle()->identifier($mixin) . " as {$mixin}_id"; } } if ($this->filterable($c)) { $filters = $this->getFilters($c); if ($filters) { $pkName = $tableSpecifier . '.' . $this->getStyle()->identifier($c->getName()); if ($filters == array('*')) { $selectColumns[] = $pkName; } else { $selectColumns = array($tableSpecifier . '.' . $this->getStyle()->identifier($c->getName())); foreach ($filters as $f) { $selectColumns[] = "{$tableSpecifier}.{$f}"; } } if ($c->getNext()) { $selectColumns[] = $tableSpecifier . '.' . $this->getStyle()->remoteIdentifier($c->getNext()->getName()); } $selectTable = array_merge($selectTable, $selectColumns); } } else { $selectTable[] = "{$tableSpecifier}.*"; } } return $sql->select($selectTable); }