diff --git a/CHANGELOG.md b/CHANGELOG.md index d85daff14..0b3ee76a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ - Enh #915: Remove `ColumnInterface` (@Tigrov) - Enh #917: Rename `ColumnSchemaInterface` to `ColumnInterface` (@Tigrov) - Enh #919: Replace `name()` with immutable `withName()` method in `ColumnInterface` interface (@Tigrov) +- Enh #921: Move `DataType` class to `Yiisoft\Db\Constant` namespace (@Tigrov) ## 1.3.0 March 21, 2024 diff --git a/UPGRADE.md b/UPGRADE.md index da8e9c863..2c8b0c6a7 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -163,3 +163,4 @@ Each table column has its own class in the `Yiisoft\Db\Schema\Column` namespace - Allow `QueryInterface::one()` to return an object; - Allow `QueryInterface::all()` to return array of objects; - Change `Quoter::quoteValue()` parameter type and return type from `mixed` to `string`; +- Move `DataType` class to `Yiisoft\Db\Constant` namespace; diff --git a/docs/guide/en/queries/transactions.md b/docs/guide/en/queries/transactions.md index 16dac369c..3fec2c8fd 100644 --- a/docs/guide/en/queries/transactions.md +++ b/docs/guide/en/queries/transactions.md @@ -5,7 +5,7 @@ In order for the data to be consistent when multiple commands are involved, you ```php use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Query\Query; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; /** @var ConnectionInterface $db */ diff --git a/docs/guide/pt-BR/queries/transactions.md b/docs/guide/pt-BR/queries/transactions.md index a55e51280..4033a3fc9 100644 --- a/docs/guide/pt-BR/queries/transactions.md +++ b/docs/guide/pt-BR/queries/transactions.md @@ -5,7 +5,7 @@ Para que os dados sejam consistentes quando vĂ¡rios comandos estiverem envolvido ```php use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Query\Query; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; /** @var ConnectionInterface $db */ diff --git a/src/Command/CommandInterface.php b/src/Command/CommandInterface.php index 975cb9abf..e49de909b 100644 --- a/src/Command/CommandInterface.php +++ b/src/Command/CommandInterface.php @@ -9,6 +9,7 @@ use Throwable; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Constant\ColumnType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Constant\PseudoType; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidArgumentException; diff --git a/src/Command/Param.php b/src/Command/Param.php index a521f6046..67d84c2d1 100644 --- a/src/Command/Param.php +++ b/src/Command/Param.php @@ -4,6 +4,7 @@ namespace Yiisoft\Db\Command; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Expression\ExpressionInterface; /** diff --git a/src/Command/ParamInterface.php b/src/Command/ParamInterface.php index da17a6347..abd645d07 100644 --- a/src/Command/ParamInterface.php +++ b/src/Command/ParamInterface.php @@ -4,6 +4,8 @@ namespace Yiisoft\Db\Command; +use Yiisoft\Db\Constant\DataType; + /** * This interface represents a parameter to bind to an SQL statement. */ diff --git a/src/Command/DataType.php b/src/Constant/DataType.php similarity index 95% rename from src/Command/DataType.php rename to src/Constant/DataType.php index 4a7f2f6e4..63afecebb 100644 --- a/src/Command/DataType.php +++ b/src/Constant/DataType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Db\Command; +namespace Yiisoft\Db\Constant; /** * Types of data. diff --git a/src/QueryBuilder/AbstractQueryBuilder.php b/src/QueryBuilder/AbstractQueryBuilder.php index a8f2c54bb..d9fa4a235 100644 --- a/src/QueryBuilder/AbstractQueryBuilder.php +++ b/src/QueryBuilder/AbstractQueryBuilder.php @@ -5,7 +5,7 @@ namespace Yiisoft\Db\QueryBuilder; use Yiisoft\Db\Command\CommandInterface; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Command\ParamInterface; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Connection\ServerInfoInterface; diff --git a/src/Schema/AbstractSchema.php b/src/Schema/AbstractSchema.php index 78b42cc95..3cfa7d958 100644 --- a/src/Schema/AbstractSchema.php +++ b/src/Schema/AbstractSchema.php @@ -7,7 +7,7 @@ use Psr\SimpleCache\InvalidArgumentException; use Throwable; use Yiisoft\Db\Cache\SchemaCache; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Connection\ConnectionInterface; use Yiisoft\Db\Constraint\Constraint; use Yiisoft\Db\Constraint\IndexConstraint; diff --git a/src/Schema/SchemaInterface.php b/src/Schema/SchemaInterface.php index bddc3061f..db7cc3375 100644 --- a/src/Schema/SchemaInterface.php +++ b/src/Schema/SchemaInterface.php @@ -5,7 +5,7 @@ namespace Yiisoft\Db\Schema; use Throwable; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Constant\ColumnType; use Yiisoft\Db\Constant\PseudoType; use Yiisoft\Db\Constraint\ConstraintSchemaInterface; diff --git a/tests/AbstractQueryBuilderTest.php b/tests/AbstractQueryBuilderTest.php index 49e1f940a..580683dcf 100644 --- a/tests/AbstractQueryBuilderTest.php +++ b/tests/AbstractQueryBuilderTest.php @@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase; use stdClass; use Throwable; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Command\Param; use Yiisoft\Db\Exception\Exception; use Yiisoft\Db\Exception\InvalidArgumentException; diff --git a/tests/AbstractSchemaTest.php b/tests/AbstractSchemaTest.php index 4430c9cd4..db453111e 100644 --- a/tests/AbstractSchemaTest.php +++ b/tests/AbstractSchemaTest.php @@ -5,7 +5,7 @@ namespace Yiisoft\Db\Tests; use PHPUnit\Framework\TestCase; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Tests\Support\Assert; use Yiisoft\Db\Tests\Support\TestTrait; diff --git a/tests/Common/CommonCommandTest.php b/tests/Common/CommonCommandTest.php index 6e1deef94..b43ac3334 100644 --- a/tests/Common/CommonCommandTest.php +++ b/tests/Common/CommonCommandTest.php @@ -6,7 +6,7 @@ use ReflectionException; use Throwable; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Command\Param; use Yiisoft\Db\Constant\ColumnType; use Yiisoft\Db\Constant\PseudoType; diff --git a/tests/Provider/CommandPDOProvider.php b/tests/Provider/CommandPDOProvider.php index 66f5c1dfb..62929891a 100644 --- a/tests/Provider/CommandPDOProvider.php +++ b/tests/Provider/CommandPDOProvider.php @@ -4,7 +4,7 @@ namespace Yiisoft\Db\Tests\Provider; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; class CommandPDOProvider { diff --git a/tests/Provider/CommandProvider.php b/tests/Provider/CommandProvider.php index ef542e013..d0387d58f 100644 --- a/tests/Provider/CommandProvider.php +++ b/tests/Provider/CommandProvider.php @@ -7,7 +7,7 @@ use ArrayIterator; use IteratorAggregate; use Traversable; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Command\Param; use Yiisoft\Db\Constant\ColumnType; use Yiisoft\Db\Expression\Expression; diff --git a/tests/Provider/QueryBuilderProvider.php b/tests/Provider/QueryBuilderProvider.php index bd7afa51c..977a0bf39 100644 --- a/tests/Provider/QueryBuilderProvider.php +++ b/tests/Provider/QueryBuilderProvider.php @@ -5,7 +5,7 @@ namespace Yiisoft\Db\Tests\Provider; use ArrayIterator; -use Yiisoft\Db\Command\DataType; +use Yiisoft\Db\Constant\DataType; use Yiisoft\Db\Command\Param; use Yiisoft\Db\Constant\ColumnType; use Yiisoft\Db\Constant\PseudoType;