1

I have build a library using some of the Symfony2 components and Doctrine. I now want to use this library inside a Symfony2 console app. I have included my library through Composer as a vendor, however, I'm getting the following error when I execute my library code:

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Bundle "default" does not exist or it is not enabled.' in /home/user/project/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php:90

I'm not sure what the "default" bundle would be, how this is related to Doctrine or how to start to debug this.

Any help much appreciated.

UPDATE:

This is the Composer.json for my console app:

{
    "name": "my/console",
    "type": "application",
    "repositories": [
        {
            "type": "vcs",
            "url": "[email protected]:my/library.git"
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "my/library": "dev-dev-master"
    },
    "autoload": {
        "psr-0": {
            "My\\": ["src/"]
        }
    }
}

This is the Composer.json for my library:

{
    "name": "my/library",
    "type": "library",
    "keywords": [
        "my", "library"
    ],
    "homepage": "https://www.mine.com/",
    "autoload": {
        "psr-0": { "My\\": ["src/"] }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": "2.3.*",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "underscore/underscore.php": "1.3.1",
        "sami/sami": "v1.1"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app"
    }
}
1
  • Can we see your composer.json file? Commented Aug 27, 2013 at 9:29

1 Answer 1

2

You can see what is causing this in the AbstractDoctrineExtension. As you can see, this error has something to do with the mappings you have defined in your config file.

It is also mentioned here that this error is triggered by an error in the mappings, just try to comment out what you have in the mappings.

orm:
    auto_generate_proxy_classes: %kernel.debug%
    default_entity_manager: default
    entity_managers:
        default:
            mappings:
                #whatever you have here
Sign up to request clarification or add additional context in comments.

3 Comments

If this doesn't work please post your config file (just the orm part).
Thanks for pointing me in the right direction! The problem was the location of my entities which in the context of the library development are in a different location than when used as an actual library (in which case they are located inside the vendor directory).
Just wanted to add to my above comment, I fixed by making my Doctrine entities location configurable through the parameters.yml so that in different environments they can be located in different directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.