Skip to content

Commit

Permalink
BUGFIX: Don't select *any* column() in DataQuery::initialiseQuery(); …
Browse files Browse the repository at this point in the history
…leave that until finaliseQuery(). It shouldn't be necessary and just risks field collisions.
  • Loading branch information
Sam Minnee committed May 1, 2012
1 parent 8661164 commit 5abf8cf
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions model/DataQuery.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function initialiseQuery() {
} }


$baseClass = array_shift($tableClasses); $baseClass = array_shift($tableClasses);
$select = array("\"$baseClass\".*");


// Build our intial query // Build our intial query
$this->query = new SQLQuery(array()); $this->query = new SQLQuery(array());
Expand All @@ -116,7 +115,6 @@ function initialiseQuery() {
} }


$this->query->from("\"$baseClass\""); $this->query->from("\"$baseClass\"");
$this->selectColumnsFromTable($this->query, $baseClass);


singleton($this->dataClass)->extend('augmentDataQueryCreation', $this->query, $this); singleton($this->dataClass)->extend('augmentDataQueryCreation', $this->query, $this);
} }
Expand Down Expand Up @@ -155,12 +153,6 @@ function getFinalisedQuery($queriedColumns = null) {
$tableNames = array_keys($tableClasses); $tableNames = array_keys($tableClasses);
$baseClass = $tableNames[0]; $baseClass = $tableNames[0];


// Empty the existing select query of all non-generated selects (eg, random sorts and many-many-extrafields).
// Maybe we should remove all fields that exist on this class instead?
foreach ($query->select as $name => $column) {
if (!is_numeric($name)) unset($query->select[$name]);
}

// Iterate over the tables and check what we need to select from them. If any selects are made (or the table is // Iterate over the tables and check what we need to select from them. If any selects are made (or the table is
// required for a select) // required for a select)
foreach($tableClasses as $tableClass) { foreach($tableClasses as $tableClass) {
Expand Down

0 comments on commit 5abf8cf

Please sign in to comment.