Search code examples
formsexceptionsymfonypropel

symfony propel:form:generate throws ErrorException


I work with symfony-standard 2.1

my composer.json file:

{
"name": "xxx",

"description": "xxx",
"autoload": {
    "psr-0": {
        "": "src/"
    }
},
"minimum-stability": "dev",
"authors": [
    {
        "name": "xxx",
        "email": "xxx"
    }
],
"require": {
    "php": ">=5.3.2",
    "ext-iconv": "*",
    "ext-intl": "*",
    "igorw/composer-yaml": "dev-master",
    "symfony/symfony": "2.1.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.0.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.1.*",
    "symfony/monolog-bundle": "2.1.*",
    "sensio/distribution-bundle": "2.1.*",
    "sensio/framework-extra-bundle": "2.1.*",
    "sensio/generator-bundle": "2.1.*",
    "jms/security-extra-bundle": "1.2.*",
    "jms/di-extra-bundle": "1.1.*",
    "propel/propel-bundle": "1.1.*"
},
"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
    ]
},
"config": {
    "bin-dir": "bin"
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web"
}
}

I followed the installation of propel on http://www.propelorm.org/cookbook/symfony2/working-with-symfony2.html

then I used the comman

php app/console propel:form:generate @AcmeDemoBundle Book Author

and it throws following exception:

[ErrorException] Catchable Fatal Error: Argument 1 passed to Propel\PropelBundle\Command\AbstractCommand::getSchemasFromBundle() must implement interface Symfony\Component\HttpKernel\Bundle\BundleInterface, null given, called in \vendor\propel\propel-bundle\Propel\PropelBundle\Command\FormGenerateCommand.php on line 55 and defined in \vendor\propel\propel-bundle\Propel\PropelBundle\Command\AbstractCommand.php line 268

I have tried this a few times (creating new projects and following the installation instruction of propel); I also tried it by installing all tags (one after another) of branch 1.1, but i always get the ErrorException from above. I have searched if someone has the same problem, but I haven´t found anybody and I don´t know anymore what I could do.


Solution

  • which is your os?

    if its windows and you use powershell then you might have the same problem as me. the @ sign is an operator in powershell (see What does the "@" symbol do in Powershell?)

    so in the windows powershell the bundle name has to be quoted

    php app/console propel:form:generate '@AcmeStoreBundle'
    

    maybe the problem also appears on other operation systems

    official issue: https://github.com/propelorm/PropelBundle/issues/180