0

New to Symfony here I am following this tutorial about mapping db tables to entities. I created the blog_post and blog_comment tables in my db. I tried running this php bin/console doctrine:mapping:import --force AppBundle xml which spit out the following error.

Bundle "AppBundle" does not exist or it is not enabled. Maybe you forgot to 
add it in the registerBundles() method of your App\Kernel.php file? 

My doctrine.yaml is pretty much out of the box.

Doctrine.yaml

doctrine:
dbal:
    # configure these for your database server
    driver: 'pdo_mysql'
    server_version: '5.7'
    charset: utf8mb4

    # With Symfony 3.3, remove the `resolve:` prefix
    url: '%env(resolve:DATABASE_URL)%'
orm:
    auto_generate_proxy_classes: '%kernel.debug%'
    naming_strategy: doctrine.orm.naming_strategy.underscore
    auto_mapping: true
    mappings:
        App:
            is_bundle: true
            type: annotation
            dir: '%kernel.project_dir%/src/Entity'
            prefix: 'App\Entity'
            alias: App

I created the App.php Class under src/Entity/ and added a line under bundles.php but still get an error. The line I added on bundles.php is App\Entity\App::class=>['all' => true], since that is the defined namespace of my App.php class.

Another error I get is

PHP Fatal error:  Uncaught 
Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load 
class "App" from namespace "App\Entity\App".
Did you forget a "use" statement for another namespace? in 
/var/www/html/quick_tour/src/Kernel.php:32
1

2 Answers 2

1

you must use App rather than AppBundle on Symfony 4

Sign up to request clarification or add additional context in comments.

Comments

1

Found similar situation to mine in here as well.

Since Symfony 4 Use App instead of Appbundle

Comments

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.