Hi everybody,

I would like to create the database from cli, but there is an issue
with the doctrine dbal configuration. I already tried a few things to
figure out where it comes from...

That's how my yaml dbal config looks like:

# Doctrine Configuration
doctrine.dbal:
    default_connection:    default
    connections:
        default:
            driver:   pdo_mysql
            dbname:   sf2
            user:     sf2
            password: something
            logging:  %kernel.debug%
        custom:
            driver:   pdo_mysql
            dbname:   sf2
            user:     sf2
            password: something
            logging:  %kernel.debug%


If I try to use the create database coomand (php app/console
doctrine:database:create -v), It gives me this error message:

+++++

[InvalidArgumentException]
The parameter "doctrine.dbal.default_connection" must be defined.

Exception trace:
 () at /var/www/dev.softwise.de/app/cache/prod/
appProdProjectContainer.php:218
 appProdProjectContainer->getParameter() at /var/www/dev.softwise.de/
vendor/symfony/src/Symfony/Bundle/DoctrineBundle/Command/
DoctrineCommand.php:103
 Symfony\Bundle\DoctrineBundle\Command\DoctrineCommand-
>getDoctrineConnection() at /var/www/dev.softwise.de/vendor/symfony/
src/Symfony/Bundle/DoctrineBundle/Command/
CreateDatabaseDoctrineCommand.php:52
 Symfony\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand-
>execute() at /var/www/dev.softwise.de/vendor/symfony/src/Symfony/
Component/Console/Command/Command.php:163
 Symfony\Component\Console\Command\Command->run() at /var/www/
dev.softwise.de/vendor/symfony/src/Symfony/Component/Console/
Application.php:187
 Symfony\Component\Console\Application->doRun() at /var/www/
dev.softwise.de/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/
Console/Application.php:73
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/
www/dev.softwise.de/vendor/symfony/src/Symfony/Component/Console/
Application.php:113
 Symfony\Component\Console\Application->run() at /var/www/
dev.softwise.de/app/console:12

+++++

So I tried: php app/console doctrine:database:create --
connection=default -v
There I get:

+++++

[InvalidArgumentException]
Could not find a connection named default

Exception trace:
 () at /var/www/dev.softwise.de/vendor/symfony/src/Symfony/Bundle/
DoctrineBundle/Command/DoctrineCommand.php:106
 Symfony\Bundle\DoctrineBundle\Command\DoctrineCommand-
>getDoctrineConnection() at /var/www/dev.softwise.de/vendor/symfony/
src/Symfony/Bundle/DoctrineBundle/Command/
CreateDatabaseDoctrineCommand.php:52
 Symfony\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand-
>execute() at /var/www/dev.softwise.de/vendor/symfony/src/Symfony/
Component/Console/Command/Command.php:163
 Symfony\Component\Console\Command\Command->run() at /var/www/
dev.softwise.de/vendor/symfony/src/Symfony/Component/Console/
Application.php:187
 Symfony\Component\Console\Application->doRun() at /var/www/
dev.softwise.de/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/
Console/Application.php:73
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/
www/dev.softwise.de/vendor/symfony/src/Symfony/Component/Console/
Application.php:113
 Symfony\Component\Console\Application->run() at /var/www/
dev.softwise.de/app/console:12

+++++

If I'm referencing from my controller:

$em = $this->get('doctrine.dbal.default_connection');

I get no exception. Does anybody have an idea what I'm doing wrong?

Thanks for reply,

Nico

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to