Skip to content

Commit

Permalink
Merge pull request #70 from clickbar/allow-sthaving-to-use-st-express…
Browse files Browse the repository at this point in the history
…ions

feat(stHaving): Allow using ST, Boxes and Geometries as value
  • Loading branch information
ahawlitschek authored Jan 19, 2024
2 parents 02b9eef + dd5835b commit 8e5db16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- Added `as` parameter for `stFrom` function
- Aligned `stHaving` with `stWhere` to also accept string column and ST expressions, boxes and geometries as value

### Fixed
- Fixed builder macro docblocks to use FQDN for an issue within laravel-ide-helper
Expand Down
10 changes: 7 additions & 3 deletions src/Database/Builder/BuilderMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,18 @@ public function stGroupBy()
public function stHaving()
{
/**
* @param \Clickbar\Magellan\Database\MagellanExpressions\MagellanStringExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBooleanExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBBoxExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanNumericExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanGeometryExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanGeometryOrBboxExpression $magellanExpression
* @param \Clickbar\Magellan\Database\MagellanExpressions\MagellanStringExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBooleanExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanBBoxExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanNumericExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanGeometryExpression|\Clickbar\Magellan\Database\MagellanExpressions\MagellanGeometryOrBboxExpression|string $magellanExpression
* @param mixed $operator
* @param mixed $value
* @param string|null $boolean
* @return static
*/
return function (MagellanStringExpression|MagellanBooleanExpression|MagellanBBoxExpression|MagellanNumericExpression|MagellanGeometryExpression|MagellanGeometryOrBboxExpression $magellanExpression, $operator = null, $value = null, $boolean = 'and') {
return $this->having($magellanExpression->invoke($this, 'having'), $operator, $value, $boolean);
return function (MagellanStringExpression|MagellanBooleanExpression|MagellanBBoxExpression|MagellanNumericExpression|MagellanGeometryExpression|MagellanGeometryOrBboxExpression|string $magellanExpression, $operator = null, $value = null, $boolean = 'and') {
return $this->having(
BuilderUtils::evaluate($this, $magellanExpression, 'having'),
BuilderUtils::evaluate($this, $operator, 'having'),
BuilderUtils::evaluate($this, $value, 'having'),
$boolean);
};
}

Expand Down

0 comments on commit 8e5db16

Please sign in to comment.