-
Notifications
You must be signed in to change notification settings - Fork 10
Support for Doctrine DBAL 3 #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amotl
wants to merge
23
commits into
main
Choose a base branch
from
amo/doctrine3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4a03d6f
DBAL3: Update to `doctrine/dbal` version 3
amotl cf2ca79
DBAL3: Adjust interfaces and autoloading to match implementation
amotl 5bfc306
DBAL3: Start populating PDOConnection, detouring from PDOCrateDB
amotl 9cf0a19
DBAL3: Code-style fixes
amotl 832226c
DBAL3: Making actual progress
amotl dbc307d
DBAL3: Apply suggestions by CodeRabbit, and more copy editing
amotl 8d8e25f
DBAL3: Minor wording updates
amotl 40283de
DBAL3: More copy editing with CodeRabbit
amotl 1038d06
Chore: Switch linter/formatter to PHP Coding Standards Fixer
amotl 40429d1
DBAL3: Rename more symbols
JulianMar fe34cf7
DBAL3: Towards DBAL4
JulianMar 4b72137
DBAL3: Implement suggestions by CodeRabbit
amotl 32c556a
DBAL3: More generic type hinting
JulianMar 8bf6a95
Chore: Naming things `s/TestCase/Test/`
amotl e15924c
Chore: Implement suggestions by CodeRabbit
amotl ec6eef9
DBAL3: Use `Doctrine\DBAL\Driver\PDO\Exception` instead of copying
amotl 05f85d5
DBAL3: At `lastInsertId`, catch `PDOException` and wrap into `DBAL` one
amotl 24d1767
DBAL3: Clarify remark about differences of the new DBAL3 Type API
amotl b07a4a4
DBAL3: Remove comment about `wrapperClass`
amotl ee38c2f
Tests: Adjust skip messages instead of blatantly using `ALTER TABLE`
amotl 425f4ee
DBAL3: Implement suggestions by CodeRabbit
amotl 9732bf6
DBAL3: Use CrateDB 5.0.0 in `getServerVersion` to select modern dialect
amotl b8a9929
DBAL3: Implement suggestions by CodeRabbit
amotl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| .project | ||
| .vagrant | ||
| .phpunit.result.cache | ||
| *.cache | ||
| *-console.log | ||
| .crate-docs | ||
| /composer.lock | ||
|
|
||
This file contains hidden or 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,28 @@ | ||
| <?php | ||
| // PHP Coding Standards Fixer | ||
| // https://cs.symfony.com/ | ||
| // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst | ||
|
|
||
| $finder = (new PhpCsFixer\Finder()) | ||
| ->in(__DIR__) | ||
| ->exclude('build') | ||
| ->exclude('vendor') | ||
| ; | ||
|
|
||
| return (new PhpCsFixer\Config()) | ||
| ->setUnsupportedPhpVersionAllowed(true) | ||
| ->setRules([ | ||
| // '@auto' => true, | ||
| // '@PHP7x3Migration' => true, | ||
| // '@PSR1' => true, | ||
| // '@PSR2' => true, | ||
| // '@PSR12' => true, | ||
| // '@Symfony' => true, | ||
| // 'array_syntax' => ['syntax' => 'short'], | ||
| 'ordered_imports' => true, | ||
| // 'strict_param' => true, | ||
| ]) | ||
| ->setFinder($finder) | ||
| ; | ||
|
|
||
| ?> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Basic example program about handling CrateDB OBJECTs with Doctrine DBAL. | ||
| * https://github.com/crate/crate-dbal | ||
| */ | ||
| require __DIR__ . '/../vendor/autoload.php'; | ||
|
|
||
| use Crate\DBAL\Platforms\CratePlatform4; | ||
| use Crate\DBAL\Types\MapType; | ||
| use Doctrine\DBAL\DriverManager; | ||
| use Doctrine\DBAL\Exception\TableNotFoundException; | ||
| use Doctrine\DBAL\Schema\Column; | ||
| use Doctrine\DBAL\Schema\Table; | ||
|
|
||
| use Doctrine\DBAL\Tools\DsnParser; | ||
| use Doctrine\DBAL\Types\Type; | ||
|
|
||
| // Initialize machinery. | ||
| // This ensures that the 'map' type is registered in the type system from the beginning. | ||
| $platform = new CratePlatform4(); | ||
|
|
||
| // Define table schema. | ||
| $table = new Table('example'); | ||
| $objDefinition = array( | ||
| 'type' => MapType::STRICT, | ||
| 'fields' => array( | ||
| new Column('id', Type::getType('integer'), array()), | ||
| new Column('name', Type::getType('string'), array()), | ||
| ), | ||
| ); | ||
| $table->addColumn( | ||
| 'data', | ||
| MapType::NAME, | ||
| array('platformOptions' => $objDefinition), | ||
| ); | ||
|
|
||
| // Register driver. | ||
| $dsnParser = new DsnParser(array('crate' => 'Crate\DBAL\Driver\PDOCrate\Driver')); | ||
|
|
||
| // Connect to database. | ||
| $connectionParams = $dsnParser->parse('crate://crate:crate@localhost:4200/'); | ||
| $connection = DriverManager::getConnection($connectionParams); | ||
| $schemaManager = $connection->createSchemaManager(); | ||
|
|
||
| // Provision database table. | ||
| try { | ||
| $schemaManager->dropTable($table->getName()); | ||
| } catch (TableNotFoundException) { | ||
| } | ||
| $schemaManager->createTable($table); | ||
|
|
||
| // Insert data. | ||
| $connection->insert('example', array('data' => array('id' => 42, 'name' => 'foo')), array('data' => 'map')); | ||
| $connection->insert('example', array('data' => array('id' => 43, 'name' => 'bar')), array('data' => 'map')); | ||
| $connection->executeStatement('REFRESH TABLE example'); | ||
|
|
||
| // Query data. | ||
| $result = $connection->executeQuery('SELECT * FROM example'); | ||
| print_r($result->fetchAllAssociative()); | ||
|
|
||
| ?> |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.