Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
[zendframework/zendframework#5857] Better logic for resetting select
Browse files Browse the repository at this point in the history
- Reset the select object whenever any of the various setters are called that
  could modify the behavior of the select.
  • Loading branch information
weierophinney committed Apr 14, 2014
1 parent 4d51c49 commit 0882e33
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Db/AbstractDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function getExclude()
public function setExclude($exclude)
{
$this->exclude = $exclude;
$this->select = null;
return $this;
}

Expand All @@ -210,7 +211,8 @@ public function getField()
*/
public function setField($field)
{
$this->field = (string) $field;
$this->field = (string) $field;
$this->select = null;
return $this;
}

Expand All @@ -232,7 +234,8 @@ public function getTable()
*/
public function setTable($table)
{
$this->table = (string) $table;
$this->table = (string) $table;
$this->select = null;
return $this;
}

Expand All @@ -255,6 +258,7 @@ public function getSchema()
public function setSchema($schema)
{
$this->schema = $schema;
$this->select = null;
return $this;
}

Expand All @@ -280,8 +284,7 @@ public function setSelect(Select $select)
*/
public function getSelect()
{
if ($this->select instanceof Select
&& ($this->getSchema() === null || $this->getTable() === '' || $this->getField() === '' || $this->getExclude() === null)) {
if ($this->select instanceof Select) {
return $this->select;
}

Expand Down

0 comments on commit 0882e33

Please # to comment.