Search code examples
phpmysqldatabasesymfonyentity

How can I delete a table from the database/ an Entity in Symfony?


I deleted in mySQL my table fields. In my entity folder I deleted also my entity fields.php

Now in the terminal I want to create a new entity with the name fields. So I type

php bin/console make:entity fields

But now I get the error message:

Compile Error: Symfony\Component\Debug\DebugClassLoader::loadClass(): Failed opening required '/Users/work/project/vendor/composer/../../src/Entity/Fields.php' (include_ path='.:/usr/local/Cellar/php/7.2.6/share/php/pear')

I added now the file fields.php again.

Now the error is gone - But I just cannot find out how to delete the Entity via terminal. There must be a way...


Solution

  • It's just a cache problem. Your entity was cached and registered for auto-loading but now cannot be found anymore. So you just have to refresh the auto-loader - I assume you're using composer

    composer dumpautoload
    

    and then clear Symfony cache

    php bin/console c:c