Skip to content

Commit 8f3bff9

Browse files
committed
Rename SelectComponent to Expression
1 parent 23ba36a commit 8f3bff9

11 files changed

+22
-42
lines changed

src/TgDatabase/Criterion/AliasedProjection.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace TgDatabase\Criterion;
44

5-
use TgDatabase\SelectComponent;
5+
use TgDatabase\Expression;
66
use TgDatabase\Query;
77

8-
class AliasedProjection implements SelectComponent {
8+
class AliasedProjection implements Expression {
99

1010
public function __construct($component, $alias) {
1111
$this->component = $component;

src/TgDatabase/Criterion/Distinct.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace TgDatabase\Criterion;
44

5-
use TgDatabase\SelectComponent;
5+
use TgDatabase\Expression;
66
use TgDatabase\Query;
77

8-
class Distinct implements SelectComponent {
8+
class Distinct implements Expression {
99

1010
public function __construct($component) {
1111
$this->component = $component;

src/TgDatabase/Criterion/MultiSelect.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace TgDatabase\Criterion;
44

5-
use TgDatabase\SelectComponent;
5+
use TgDatabase\Expression;
66
use TgDatabase\Query;
77

8-
class MultiSelect implements SelectComponent {
8+
class MultiSelect implements Expression {
99

10-
public function __construct(SelectComponent ...$components) {
10+
public function __construct(Expression ...$components) {
1111
if ((count($components) == 1) && is_array($components[0])) {
1212
$this->components = $components[0];
1313
} else {
@@ -18,7 +18,7 @@ public function __construct(SelectComponent ...$components) {
1818
/**
1919
* Add another component in combination.
2020
*/
21-
public function add(SelectComponent ...$components) {
21+
public function add(Expression ...$components) {
2222
if ((count($components) == 1) && is_array($components[0])) {
2323
$arr = $components[0];
2424
} else {

src/TgDatabase/Criterion/PropertySelect.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace TgDatabase\Criterion;
44

5-
use TgDatabase\SelectComponent;
5+
use TgDatabase\Expression;
66
use TgDatabase\Query;
77

8-
class PropertySelect implements SelectComponent {
8+
class PropertySelect implements Expression {
99

1010
public function __construct($propertyName) {
1111
$this->propertyName = $propertyName;

src/TgDatabase/Criterion/QueryImpl.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use TgDatabase\Criterion;
77
use TgDatabase\Order;
88
use TgDatabase\Projection;
9-
use TgDatabase\SelectComponent;
9+
use TgDatabase\Expression;
1010
use TgDatabase\Projections;
1111

1212

@@ -70,7 +70,7 @@ public function addOrder(Order ...$orders) {
7070
* Attention! This class removes any result class name from the query. Use #setResultClass() after calling.
7171
* @deprecated Use #setColumns() instead
7272
*/
73-
public function setProjection(SelectComponent ...$components) {
73+
public function setProjection(Expression ...$components) {
7474
$this->projections = array();
7575
$this->_addColumns($components);
7676
$this->resultClassName = NULL;
@@ -81,7 +81,7 @@ public function setProjection(SelectComponent ...$components) {
8181
* Set select columns for the query.
8282
* Attention! This class removes any result class name from the query. Use #setResultClass() after calling.
8383
*/
84-
public function setColumns(SelectComponent ...$components) {
84+
public function setColumns(Expression ...$components) {
8585
$this->projections = array();
8686
$this->_addColumns($components);
8787
$this->resultClassName = NULL;
@@ -91,7 +91,7 @@ public function setColumns(SelectComponent ...$components) {
9191
/**
9292
* Add select columns for the query.
9393
*/
94-
public function addColumns(SelectComponent ...$components) {
94+
public function addColumns(Expression ...$components) {
9595
$this->_addColumns($components);
9696
return $this;
9797
}

src/TgDatabase/Criterion/SqlProjection.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace TgDatabase\Criterion;
44

55
use TgDatabase\Query;
6-
use TgDatabase\SelectComponent;
6+
use TgDatabase\Expression;
77

8-
class SqlProjection implements SelectComponent {
8+
class SqlProjection implements Expression {
99

1010
public function __construct($sql) {
1111
$this->sql = $sql;

src/TgDatabase/Projection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
* Built-in projection types are provided by the Projections factory class. This interface
88
* might be implemented by application classes that define custom projections.
99
*/
10-
interface Projection extends SelectComponent {
10+
interface Projection extends Expression {
1111

1212
}

src/TgDatabase/Projections.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function properties(string ...$properties) {
2727
return $rc;
2828
}
2929

30-
public static function combine(SelectComponent ...$components) {
30+
public static function combine(Expression ...$components) {
3131
return new MultiSelect($components);
3232
}
3333

src/TgDatabase/Query.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ public function addOrder(Order ...$order);
2929
/**
3030
* Add select columns for the query.
3131
*/
32-
public function addColumns(SelectComponent ...$components);
32+
public function addColumns(Expression ...$components);
3333

3434
/**
3535
* Set select columns for the query.
3636
* Attention! This class removes any result class name from the query. Use #setResultClass() after calling.
3737
*/
38-
public function setColumns(SelectComponent ...$components);
38+
public function setColumns(Expression ...$components);
3939

4040
/**
4141
* Add projections for the query.
4242
* @deprecated Use #setColumns()
4343
*/
44-
public function setProjection(SelectComponent ...$components);
44+
public function setProjection(Expression ...$components);
4545

4646
/**
4747
* Set the index of the first result to be retrieved.

src/TgDatabase/SelectComponent.php

-20
This file was deleted.

tests/TgDatabase/ProjectionsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function testAlias(): void {
101101
$this->testSqlString('MAX(`aName`) AS `anotherName`', $expr);
102102
}
103103

104-
protected function testSqlString(string $expected, SelectComponent $expr, $alias = NULL): void {
104+
protected function testSqlString(string $expected, Expression $expr, $alias = NULL): void {
105105
$query = TestHelper::createQuery(NULL, NULL, $alias);
106106
if ($query != NULL) {
107107
$this->assertEquals($expected, $expr->toSqlString($query,$query));

0 commit comments

Comments
 (0)