Skip to content

Commit

Permalink
Merge branch 'developer'
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-deluna committed Nov 5, 2018
2 parents 29955bd + cbf7c43 commit 0bd6dec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm
- nightly

Expand Down
33 changes: 33 additions & 0 deletions src/Query/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

use ClanCats\Hydrahon\Query\Expression;

use ClanCats\Hydrahon\BaseQuery;

class Select extends SelectBase implements FetchableInterface
{
/**
Expand Down Expand Up @@ -62,6 +64,37 @@ class Select extends SelectBase implements FetchableInterface
*/
protected $forwardKey = false;

/**
* Inherit property values from parent query
*
* @param BaseQuery $parent
* @return void
*/
protected function inheritFromParent(BaseQuery $parent)
{
parent::inheritFromParent($parent);

if ($parent instanceof Select) {
$parent->copyTo($this);
}
}

/**
* Copy current queries select attributes to the given one
*
* @param Select $query
*/
public function copyTo(Select $query)
{
$query->fields = $this->fields;
$query->distinct = $this->distinct;
$query->orders = $this->orders;
$query->groups = $this->groups;
$query->joins = $this->joins;
$query->groupResults = $this->groupResults;
$query->forwardKey = $this->forwardKey;
}

/**
* Distinct select setter
*
Expand Down

0 comments on commit 0bd6dec

Please sign in to comment.