So while following this guide in the documentation to try to reverse engineer my database with Doctrine, I got the following 100% absolutely nonsensical error
Importing mapping information from "default" entity manager writing src/Entity/AffiliateArticleViews.php writing src/Entity/AffiliateJoinCounts.php writing src/Entity/AffiliateRegistration.php writing src/Entity/BlogMedia.php writing src/Entity/CommentReplyConclusionOptions.php writing src/Entity/CommentReplyReportReasons.php writing src/Entity/DoctrineMigrationVersions.php writing src/Entity/FavoredImages.phP In DebugClassLoader.php line 346: Warning: include(/var/www/sogi/sogizmo/vendor/composer/../../src/Entity/FavoredImages.php): failed to open stream: No such file or directory
To someone who doesn’t work on the Symfony core that might as well say “boasdfkajsdfiioaysdfiuasdfiouasdfiouasdiofu”
So I had to research this issue.
Ok so I found this link with a little more info and I ran the following line of code.
php vendor/bin/doctrine orm:generate-entities --help
Which barfed out these lines of more mysteries to be solved.
You are missing a "cli-config.php" or "config/cli-config.php" file in your project, which is required to get the Doctrine Console working. You can use the following sample as a template:
<?php use Doctrine\ORM\Tools\Console\ConsoleRunner; // replace with file to your own project bootstrap require_once 'bootstrap.php'; // replace with mechanism to retrieve EntityManager in your app $entityManager = GetEntityManager(); return ConsoleRunner::createHelperSet($entityManager); </code
Leaving me wondering WTF is this even talking about like…
Google and dig as I may I only found one Stack answer that explained how to created the mess of files required. Sure would be nice if that was in the Doctrine docs…
But I kept digging, trying, failing… and it turns out that the first error I got means…. wait for it…. MY USER DOCTRINE IS RUNNING AS CAN’T WRITE TO THE DIRECTORY. Now wouldn’t it make much more sense to give that as an error message?
So I changed the Entity directory permissions to 775 since my server www-data was already a member of a group which was the group owner of that directory. And the first command finally worked like it had before. Some how somewhere along the way I set permissions on the Entity and all folders to 755.
The error messages were no help. I just randomly decided to try creating another test folder with 775 and ran the first command again. I accidentally guessed what the problem was from a nonsensical error message. Desperation wins in the problem solving game. LOL
That wasn’t the end though. When I tried to run the second command I got another nonsensical error about my Entity classes already exist. I was like I know the first command created them WTF. Kept googling and searching and scratching my head. Then I remembered I created the test folder so I deleted it and BOOM BANG POW. Everything was working fine.