Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of 'void' Return Type Declaration in AbstractSpatialDQLFunction #223

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d6d8ff7
Update install.md
ktzouno Jun 23, 2016
191f8d3
Merge pull request #159 from ktzouno/patch-1
sadortun Jun 23, 2016
4032b87
Fix PostgreSql function class names
teohhanhui Jul 15, 2016
1824a6f
Merge pull request #162 from teohhanhui/patch-2
sadortun Jul 15, 2016
c24d779
Update configuration.md
tgabi333 Sep 2, 2016
5829a52
Merge pull request #165 from tgabi333/patch-1
sadortun Dec 3, 2016
8ae16cc
Added support for geometry function
dragosprotung Dec 15, 2016
caa84a2
Merge pull request #167 from dragosprotung/geometry
sadortun Dec 15, 2016
23e47b9
Added support for ST_Collect function
dragosprotung Dec 15, 2016
065686e
Merge pull request #168 from dragosprotung/stcollect
sadortun Dec 15, 2016
43f6826
Support PHP 7.1
dragosprotung Dec 15, 2016
a35f9c1
Added ST_SnapToGrid support
dragosprotung Dec 15, 2016
9ef9003
Improved getting the sql for functions
dragosprotung Dec 15, 2016
8b73c5d
Merge pull request #171 from dragosprotung/improvedgetsql
sadortun Dec 16, 2016
82649ac
Merge pull request #169 from dragosprotung/php71
sadortun Dec 16, 2016
dc28144
Merge pull request #170 from dragosprotung/stsnaptogrid
sadortun Dec 16, 2016
3e040af
Implemented ST_Overlaps
dragosprotung Jan 6, 2017
f354743
Merge pull request #172 from dragosprotung/stoverlaps
sadortun Jan 6, 2017
404aadf
Added test for polygon from array of points
dragosprotung Jan 10, 2017
7211e90
Merge pull request #173 from dragosprotung/testSolidPolygonFromArrayO…
sadortun Jan 10, 2017
1e22d0f
Fix indent.
masayuki14 Jul 13, 2017
f14e0d4
Merge pull request #179 from masayuki14/patch-2
sadortun Jul 13, 2017
58ea5fa
Update INSTALL.md
sadortun Jul 13, 2017
24a5eee
Create STGeomFromText
Charles-Emmanuel-DEZANDEE Oct 30, 2020
6c37638
Merge pull request #213 from Charles-Emmanuel-DEZANDEE/patch-1
sadortun Oct 30, 2020
5b9c0f4
Fix typo
pamuche Jul 6, 2021
8ce00f1
Merge pull request #216 from pamuche/patch-1
sadortun Jul 6, 2021
99be6ec
Added ST_Distance_Sphere and ST_Distance to mysql (#191)
0x6368 Sep 20, 2023
ca45fe9
Added 'void' Native Return Type Declaration in 'AbstractSpatialDQLFun…
enzobrigati Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ language: php
sudo: false

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- hhvm

env:
- ORM=2.3
- ORM=2.4
- ORM=2.5

addons:
postgresql: 9.6
apt:
packages:
- postgresql-9.6-postgis-2.3


before_script:
- composer self-update
- cp ./tests/travis/composer.orm$ORM.json ./composer.json
Expand Down
207 changes: 109 additions & 98 deletions INSTALL.md

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ Add the types and functions you need to your Symfony configuration file. The doc
orm:
dql:
numeric_functions:
numeric_functions:
st_contains: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STContains
contains: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Contains
st_area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area
st_geomfromtext: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\GeomFromText
st_intersects: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STIntersects
st_buffer: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STBuffer
point: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Point
st_contains: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STContains
contains: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Contains
st_area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area
st_geomfromtext: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\GeomFromText
st_intersects: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STIntersects
st_buffer: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\STBuffer
point: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Point
4 changes: 2 additions & 2 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Use these instructions if you're using Doctrine with Symfony2 , otherwise the OrmTest.php test class shows their use with Doctrine alone.

Require the `CrEOF/spatial2-doctrine` package in your composer.json and update
Require the `CrEOF/doctrine2-spatial` package in your composer.json and update
your dependencies.

$ composer require CrEOF/spatial2-doctrine
$ composer require CrEOF/doctrine2-spatial

## composer.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ abstract class AbstractSpatialDQLFunction extends FunctionNode

/**
* @param Parser $parser
*
* @return void
*/
public function parse(Parser $parser)
public function parse(Parser $parser): void
{
$lexer = $parser->getLexer();

Expand All @@ -94,19 +96,12 @@ public function getSql(SqlWalker $sqlWalker)
{
$this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform());

$result = sprintf('%s(', $this->functionName);

for ($i = 0, $size = count($this->geomExpr); $i < $size;) {
$result .= $this->geomExpr[$i]->dispatch($sqlWalker);

if (++$i < $size) {
$result .= ', ';
}
$arguments = array();
foreach ($this->geomExpr as $expression) {
$arguments[] = $expression->dispatch($sqlWalker);
}

$result .= ')';

return $result;
return sprintf('%s(%s)', $this->functionName, implode(', ', $arguments));
}

/**
Expand All @@ -118,8 +113,10 @@ protected function validatePlatform(AbstractPlatform $platform)
{
$platformName = $platform->getName();

if (isset($this->platforms) && ! in_array($platformName, $this->platforms)) {
throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $platformName));
if (isset($this->platforms) && !in_array($platformName, $this->platforms)) {
throw new UnsupportedPlatformException(
sprintf('DBAL platform "%s" is not currently supported.', $platformName)
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* Copyright (C) 2013 Christian Bieg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\MySql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* STDistance DQL function
*
* @author Christian Bieg <[email protected]>
* @license http://dlambert.mit-license.org MIT
*/
class STDistanceSphere extends AbstractSpatialDQLFunction {

protected $platforms = array('mysql');
protected $functionName = 'ST_Distance_SPHERE';
protected $minGeomExpr = 2;
protected $maxGeomExpr = 2;

}
42 changes: 42 additions & 0 deletions lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STGeomFromText
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Copyright (C) 2020 Dezandee Charles-emmanuel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\MySql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* STGeomFromText DQL function
*
* @author Dezandee Charles-emmanuel <[email protected]>
*/
class STGeomFromText extends AbstractSpatialDQLFunction
{
protected $platforms = array('mysql');

protected $functionName = 'ST_GEOMFROMTEXT';

protected $minGeomExpr = 1;

protected $maxGeomExpr = 1;
}
42 changes: 42 additions & 0 deletions lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STGeomFromText.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* Copyright (C) 2012 Christian Bieg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\MySql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* ST_GeomFromText DQL function
*
* @author Christian Bieg <[email protected]>
*/
class STGeomFromText extends AbstractSpatialDQLFunction
{
protected $platforms = array('mysql');

protected $functionName = 'ST_GeomFromText';

protected $minGeomExpr = 1;

protected $maxGeomExpr = 2;
}
43 changes: 43 additions & 0 deletions lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* Geometry DQL function
*
* @author Derek J. Lambert <[email protected]>
* @license http://dlambert.mit-license.org MIT
*/
class Geometry extends AbstractSpatialDQLFunction
{
protected $platforms = array('postgresql');

protected $functionName = 'geometry';

protected $minGeomExpr = 1;

protected $maxGeomExpr = 1;
}
43 changes: 43 additions & 0 deletions lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Copyright (C) 2016 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* ST_Collect DQL function
*
* @author Derek J. Lambert <[email protected]>
* @license http://dlambert.mit-license.org MIT
*/
class STCollect extends AbstractSpatialDQLFunction
{
protected $platforms = array('postgresql');

protected $functionName = 'ST_Collect';

protected $minGeomExpr = 1;

protected $maxGeomExpr = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* Copyright (C) 2017 Derek J. Lambert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql;

use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;

/**
* ST_Overlaps DQL function.
*
* @author Dragos Protung
* @license http://mit-license.org MIT
*/
class STOverlaps extends AbstractSpatialDQLFunction
{
protected $platforms = array('postgresql');

protected $functionName = 'ST_Overlaps';

protected $minGeomExpr = 2;

protected $maxGeomExpr = 2;
}
Loading