Skip to content
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

[FEATURE] Allow other adapters for Phinx configuration #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bmoex
Copy link

@bmoex bmoex commented Jul 11, 2022

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.

Copy link
Member

@mbrodala mbrodala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response, please have a look at my remarks.

{
return $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'];
switch ($connection->getDatabasePlatform()->getName()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Member

@mbrodala mbrodala Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants