Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
methods (@Tigrov)
- Enh #1049: Refactor `AbstractDQLQueryBuilder::buildSelect()` to fix possible bugs (@Tigrov)
- Enh #1051: Refactor `Quoter` class (@Tigrov)
- Chg #1052: Rearrange expression namespaces (@Tigrov)

## 1.3.0 March 21, 2024

Expand Down
2 changes: 1 addition & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ Each table column has its own class in the `Yiisoft\Db\Schema\Column` namespace
- `ConditionInterface` moved to `Yiisoft\Db\QueryBuilder\Condition` namespace;
- Remove `AbstractConjunctionCondition` and `AbstractOverlapsConditionBuilder`;
- Change namespace of condition and condition builder classes;
- Change namespace of expression and expression builder classes;
- Remove `AbstractDsn` and `AbstractDsnSocket` classes and `DsnInterface` interface;
- Remove `Hash` condition;
- Remove `AbstractTableSchema` and add `TableSchema` instead;
- Remove `BetweenColumns` condition;
- Move expression builders to `Yiisoft\Db\Expression\Builder` namespace;
- Change `QueryBuilderInterface::getExpressionBuilder()` result type to `ExpressionBuilderInterface`;
- Change `DQLQueryBuilderInterface::getExpressionBuilder()` result type to `ExpressionBuilderInterface`;

4 changes: 2 additions & 2 deletions docs/guide/en/expressions/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
The library provides several classes to represent SQL functions as expressions.

> [!WARNING]
> The functions do not quote string values or column names, use [Value](../../../../src/Expression/Value.php)
> expression for string values and [ColumnName](../../../../src/Expression/ColumnName.php) expression for column names
> The functions do not quote string values or column names, use [Value](../../../../src/Expression/Value/Value.php)
> expression for string values and [ColumnName](../../../../src/Expression/Value/ColumnName.php) expression for column names
> or quote the values directly.
>
> For example, `new Longest(new Value('short'), new ColumnName('column'), "'longest'")`
Expand Down
2 changes: 1 addition & 1 deletion src/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Throwable;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Query\DataReaderInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\DMLQueryBuilderInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Query\DataReaderInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\DMLQueryBuilderInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Pdo/AbstractPdoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Psr\Log\LogLevel;
use Throwable;
use Yiisoft\Db\Command\AbstractCommand;
use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Exception\ConvertException;
use Yiisoft\Db\Exception\Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression;

use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Expression\Expression;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

use function array_merge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;

use Yiisoft\Db\Expression\ExpressionInterface;
namespace Yiisoft\Db\Expression;

/**
* This interface defines the methods to build database expressions, such as conditions for a SELECT statement or values
Expand Down
2 changes: 0 additions & 2 deletions src/Expression/ExpressionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Yiisoft\Db\Expression;

use Yiisoft\Db\Expression\Builder\ExpressionBuilderInterface;

/**
* This interface defines a set of methods that an object should implement to represent an expression in database
* queries, such as one for filtering or ordering results.
Expand Down
2 changes: 1 addition & 1 deletion src/Expression/Function/Builder/LengthBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Yiisoft\Db\Expression\Function\Builder;

use Yiisoft\Db\Expression\Builder\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\Function\Length;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Yiisoft\Db\Expression\Function\Builder;

use InvalidArgumentException;
use Yiisoft\Db\Expression\Builder\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\Function\MultiOperandFunction;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Statement\Builder;

use InvalidArgumentException;
use Yiisoft\Db\Constant\GettypeResult;
use Yiisoft\Db\Expression\CaseExpression;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\Statement\CaseExpression;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Statement;

use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\Schema\Column\ColumnInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Statement;

use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use Traversable;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\ColumnDefinitionBuilderInterface;
use Yiisoft\Db\Schema\Column\ColumnFactoryInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\ArrayExpression;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\Value\ArrayExpression;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Exception\Exception;
use InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\StructuredExpression;
use Yiisoft\Db\Expression\Value\StructuredExpression;
use Yiisoft\Db\Helper\DbArrayHelper;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Constant\DataType;
use Yiisoft\Db\Expression\ArrayExpression;
use Yiisoft\Db\Expression\Value\ArrayExpression;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\Schema\Data\JsonLazyArray;
use Yiisoft\Db\Schema\Data\LazyArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\ColumnName;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\Value\ColumnName;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Expression/Value/Builder/DateTimeValueBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Constant\ColumnType;
use Yiisoft\Db\Expression\Builder\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\Value\DateTimeValue;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use JsonException;
use JsonSerializable;
use Traversable;
use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Constant\DataType;
use Yiisoft\Db\Exception\Exception;
use InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\JsonExpression;
use Yiisoft\Db\Expression\Value\JsonExpression;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\Data\JsonLazyArray;
use Yiisoft\Db\Schema\Data\LazyArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;

use function count;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\Param;
use Yiisoft\Db\Expression\Value\Param;
use Yiisoft\Db\Constant\DataType;
use Yiisoft\Db\Expression\StructuredExpression;
use Yiisoft\Db\Expression\Value\StructuredExpression;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\Schema\Data\JsonLazyArray;
use Yiisoft\Db\Schema\Data\LazyArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression\Builder;
namespace Yiisoft\Db\Expression\Value\Builder;

use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Expression\Value;
use Yiisoft\Db\Expression\Value\Value;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use Yiisoft\Db\Expression\ExpressionInterface;

/**
* Represents a column name expression for SQL queries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use Yiisoft\Db\Expression\ExpressionInterface;

/**
* Represents data to encode to JSON.
Expand Down
3 changes: 2 additions & 1 deletion src/Expression/Param.php → src/Expression/Value/Param.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use Yiisoft\Db\Constant\DataType;
use Yiisoft\Db\Expression\ExpressionInterface;

/**
* Represents a parameter used in building an SQL statement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use JsonSerializable;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\Schema\Column\AbstractStructuredColumn;

Expand Down
4 changes: 3 additions & 1 deletion src/Expression/Value.php → src/Expression/Value/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

namespace Yiisoft\Db\Expression;
namespace Yiisoft\Db\Expression\Value;

use Yiisoft\Db\Expression\ExpressionInterface;

/**
* Represents a value for SQL queries.
Expand Down
2 changes: 1 addition & 1 deletion src/Query/QueryExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\Builder\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionBuilderInterface;
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;

Expand Down
Loading
Loading