[FEATURE] Allow other adapters for Phinx configuration#29
Open
bmoex wants to merge 2 commits intopagemachine:masterfrom
Open
[FEATURE] Allow other adapters for Phinx configuration#29bmoex wants to merge 2 commits intopagemachine:masterfrom
bmoex wants to merge 2 commits intopagemachine:masterfrom
Conversation
mbrodala
requested changes
Mar 22, 2023
Member
mbrodala
left a comment
There was a problem hiding this comment.
Sorry for the late response, please have a look at my remarks.
| private function getEnvironment(Connection $connection): array | ||
| { | ||
| return $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']; | ||
| switch ($connection->getDatabasePlatform()->getName()) { |
Member
There was a problem hiding this comment.
Seems like we could put this directly in $adapter instead.
Also what's the reason from using a connection instead of the raw TYPO3 config?
Comment on lines
+44
to
+46
| $pathInfo = pathinfo($connection->getDatabase()); | ||
| $name = $pathInfo['dirname'] . '/' . $pathInfo['filename']; | ||
| $suffix = '.' . $pathInfo['extension']; |
Member
There was a problem hiding this comment.
There seems to be a lot of magic / hidden knowledge going on here. Is there no Doctrine DBAL API for this?
|
|
||
| return [ | ||
| 'adapter' => $adapter, | ||
| 'host' => $connection->getParams()['host'] ?? null, |
Member
There was a problem hiding this comment.
I'd at least call getParams() only once. Also it seems like we can basically return that $params then.
Finally getParams() is marked as @internal so we should not rely on it.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See: https://book.cakephp.org/phinx/0/en/configuration.html#supported-adapters
My instance crashes as i use sqlite. This PR checks per connection configured configuration and returns the environment array for phinx.