Skip to content

Commit

Permalink
Add ORM3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Feb 6, 2024
1 parent ffccbed commit 13a955b
Show file tree
Hide file tree
Showing 181 changed files with 1,131 additions and 871 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/orm2_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ORM2 Tests

on: ["push", "pull_request"]

jobs:
build:
name: PHP ${{ matrix.php }} (${{ matrix.dependency }})

runs-on: ubuntu-latest

strategy:
matrix:
dependency:
- lowest
- highest
php:
- 7.2
- 7.3
- 7.4
- 8.0

steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- run: composer validate

- uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependency }}"

- run: composer run test
10 changes: 4 additions & 6 deletions .github/workflows/tests.yml → .github/workflows/orm3_tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: Tests
name: ORM3 Tests

on: ["push", "pull_request"]

jobs:
build:
name: PHP ${{ matrix.php }}
name: PHP ${{ matrix.php }} with ORM3

runs-on: ubuntu-latest

strategy:
matrix:
php:
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
Expand All @@ -29,5 +25,7 @@ jobs:
- run: composer validate

- uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- run: composer run test
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
],
"require": {
"php": "^7.2 || ^8.0",
"doctrine/orm": "^2.15"
"doctrine/orm": "dev-feature/token-type-bridge"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/connorhu/doctrine2"
}
],
"require-dev": {
"doctrine/annotations": "^1.14 || ^2",
"doctrine/coding-standard": "^9.0.2 || ^12.0",
Expand Down
8 changes: 4 additions & 4 deletions src/Query/Mysql/Acos.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class Acos extends FunctionNode
{
Expand All @@ -20,11 +20,11 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->arithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions src/Query/Mysql/AddTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

/** @author Pascal Wacker <[email protected]> */
class AddTime extends FunctionNode
Expand All @@ -21,15 +21,15 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->date = $parser->ArithmeticPrimary();

$parser->match(Lexer::T_COMMA);
$parser->match(TokenType::T_COMMA);

$this->time = $parser->ArithmeticPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions src/Query/Mysql/AesDecrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

use function sprintf;

Expand All @@ -17,12 +17,12 @@ class AesDecrypt extends FunctionNode

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);
$this->field = $parser->StringExpression();
$parser->match(Lexer::T_COMMA);
$parser->match(TokenType::T_COMMA);
$this->key = $parser->StringExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}

public function getSql(SqlWalker $sqlWalker): string
Expand Down
10 changes: 5 additions & 5 deletions src/Query/Mysql/AesEncrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

use function sprintf;

Expand All @@ -17,12 +17,12 @@ class AesEncrypt extends FunctionNode

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);
$this->field = $parser->StringExpression();
$parser->match(Lexer::T_COMMA);
$parser->match(TokenType::T_COMMA);
$this->key = $parser->StringExpression();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}

public function getSql(SqlWalker $sqlWalker): string
Expand Down
8 changes: 4 additions & 4 deletions src/Query/Mysql/AnyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

use function sprintf;

Expand All @@ -15,10 +15,10 @@ class AnyValue extends FunctionNode

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);
$this->value = $parser->StringPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}

public function getSql(SqlWalker $sqlWalker): string
Expand Down
8 changes: 4 additions & 4 deletions src/Query/Mysql/Ascii.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class Ascii extends FunctionNode
{
Expand All @@ -18,11 +18,11 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->string = $parser->ArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions src/Query/Mysql/Asin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class Asin extends FunctionNode
{
Expand All @@ -20,11 +20,11 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->arithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
12 changes: 6 additions & 6 deletions src/Query/Mysql/Atan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\QueryException;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class Atan extends FunctionNode
{
Expand All @@ -32,19 +32,19 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->arithmeticExpression = $parser->SimpleArithmeticExpression();

try {
$parser->match(Lexer::T_COMMA);
$parser->match(TokenType::T_COMMA);

$this->optionalSecondExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
} catch (QueryException $e) {
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
}
10 changes: 5 additions & 5 deletions src/Query/Mysql/Atan2.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class Atan2 extends FunctionNode
{
Expand All @@ -28,15 +28,15 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->firstExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_COMMA);
$parser->match(TokenType::T_COMMA);

$this->secondExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions src/Query/Mysql/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

/** @author Sarjono Mukti Aji <[email protected]> */
class Binary extends FunctionNode
Expand All @@ -14,12 +14,12 @@ class Binary extends FunctionNode

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}

public function getSql(SqlWalker $sqlWalker): string
Expand Down
8 changes: 4 additions & 4 deletions src/Query/Mysql/BitCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;

class BitCount extends FunctionNode
{
Expand All @@ -21,11 +21,11 @@ public function getSql(SqlWalker $sqlWalker): string

public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(TokenType::T_IDENTIFIER);
$parser->match(TokenType::T_OPEN_PARENTHESIS);

$this->arithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->match(TokenType::T_CLOSE_PARENTHESIS);
}
}
Loading

0 comments on commit 13a955b

Please sign in to comment.