-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from stargazer-team/fear-update-config
feat: Update config and dependency.
- Loading branch information
Showing
11 changed files
with
215 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
# Yii3 Doctrine Change Log | ||
|
||
## 1.0.0 under development | ||
|
||
- Initial release. | ||
## 2.1.0 | ||
|
||
- Dbal: | ||
- add config section "connections" | ||
- move section "custom_types" | ||
- add options "mapping_types", "disable_type_comments", "schema_manager_factory" | ||
- ORM: | ||
- add options "identity_generation_preferences" | ||
- Update dependency | ||
|
||
## 1.0.1 | ||
## 2.0.0 | ||
|
||
- Support doctrine orm 3. | ||
- Update dependency | ||
- Update cache | ||
- Add config options | ||
- Fix pipeline | ||
|
||
## 1.0.2 | ||
|
||
- Fix readme. | ||
|
||
## 2.0.0 | ||
## 1.0.1 | ||
|
||
- Update dependency | ||
- Update cache | ||
- Add config options | ||
- Fix pipeline | ||
- Support doctrine orm 3. | ||
|
||
## 1.0.0 under development | ||
|
||
- Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Yii\Doctrine\Dbal; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Doctrine\DBAL\ConnectionException; | ||
use Doctrine\DBAL\Exception\DriverException; | ||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Types\Type; | ||
|
||
use const PHP_EOL; | ||
|
||
final class CustomerTypeConfigurator | ||
{ | ||
public function add(array $customTypes): void | ||
{ | ||
foreach ($customTypes as $name => $className) { | ||
if (!Type::hasType($name)) { | ||
Type::addType($name, $className); | ||
} | ||
} | ||
} | ||
|
||
public function registerDoctrineTypeMapping(Connection $connection, array $mappingTypes): void | ||
{ | ||
$platform = $this->getDatabasePlatform($connection); | ||
|
||
foreach ($mappingTypes as $dbType => $doctrineType) { | ||
$platform->registerDoctrineTypeMapping($dbType, $doctrineType); | ||
} | ||
} | ||
|
||
private function getDatabasePlatform(Connection $connection): AbstractPlatform | ||
{ | ||
try { | ||
return $connection->getDatabasePlatform(); | ||
} catch (DriverException $driverException) { | ||
throw new ConnectionException( | ||
'An exception occurred while establishing a connection to figure out your platform version.' . PHP_EOL . | ||
"You can circumvent this by setting a 'server_version' configuration value" . PHP_EOL . PHP_EOL . | ||
'For further information have a look at:' . PHP_EOL, | ||
0, | ||
$driverException, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.