Having issue on installing symfony doctrine-migrations-bundle - symfony

While I run command php composer.phar update it shows the following error. Can anyone help me out for fix it?
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Fatal error: Call to protected DoctrineORMEntit
yManager_000000001f94ab4b000000005d7f3b02e5139c916d21af4abfe5ffe5dd20d49e::__construct() from context 'appDevDebugProjectCon
tainer' in /var/www/html/app/cache/dev/appDevDebugProjectContainer.php:747
Stack trace:
#0 /var/www/html/app/bootstrap.php.cache(2125): appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService()
#1 /var/www/html/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/ManagerRegistry.php(35): Symfony\Component\DependencyInj
ection\Container->get('doctrine.orm.de...')
#2 /var/www/html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php(231): Symfony\Bridge\Doc
trine\ManagerRegistry->getService('doctrine.orm.de...')
#3 /var/www/html/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php(54): Doctrine\Common\Pe
rsistence\AbstractManagerRegistry->getManagers()
#4 /var/www/html/vendor/symfony/symfony/src/Symfony/Compo in /var/www/html/app/cache/dev/appDevDebugProjectContainer.php on
line 747

First remove the bundle from your composer.json.
Then try :
// replace app by var depending on your symfony version (2 or 3)
rm -Rf app/cache
// clean all your dependencies
rm -Rf vendor
// reinstall them from your composer.lock
composer install
// install this particular bundle
composer require doctrine/doctrine-migrations-bundle "^1.0"

Related

Symfony deployment: error code 255 with composer install --no-dev

Here are the steps, I am following:
Cloning my repository from github
git clone https://github.com/EresDev/EresNoteSymfony.git .
Updating .env file with APP_ENV=prod
Then performing install
composer install --no-dev
I get following error:
.
.
.
- Installing symfony/translation (v4.2.4): Loading from cache
- Installing symfony/validator (v4.2.4): Loading from cache
- Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
Script #auto-scripts was called via post-install-cmd
However, it works fine if I just use composer install without --no-dev
What can I do to make it work with --no-dev
Please refer to repository to access code if required.
apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run with commit e722218...)
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!! Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!! Stack trace:
!! #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!
you should somehow turn error display on ;o)
update:
your config/bundles.php:6 says:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)
after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.

Error:symfony 3 Uncaught Twig_Error_Loader: [duplicate]

This question already has an answer here:
Symfony2: ResourceNotFoundException when using extends in a twig template
(1 answer)
Closed 4 years ago.
i downloaded a Symfony project from my friends run both
Composer update and php bin/console doctrine:schema:update --force
commands without errors
but when i open the project on my browser i get this error:
Fatal error: Uncaught Symfony\Component\Routing\Exception\ResourceNotFoundException in /Applications/MAMP/htdocs/Animaux/Animaux/var/cache/prod/appProdProjectContainerUrlMatcher.php:407 Stack trace: #0 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php(90): appProdProjectContainerUrlMatcher->match('/app_dev.app/') #1 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php(262): Symfony\Component\Routing\Matcher\UrlMatcher->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #2 /Applications/MAMP/htdocs/Animaux/Animaux/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php(104): Symfony\Component\Routing\Router->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #3 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\ in /Applications/MAMP/htdocs/Animaux/Animaux/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 101
help me please
Composer update - It is a bad idea. For normal development or migrate to production, you need to use the same version of dependencies, with the project must be provided composer.lock file (versions of dependencies), and you need to use composer install instead of Composer update.
...Animaux/var/cache/prod/app... it meant you didn't clear the cache, for development use https://your_host.com/app_dev.php for production - clear the cache php bin/console cache:clear -e prod
Check for PHP version, it must be the same of development.

Cannot Composer Install with Symfony - PhpStorm

I had a problem with my Ubuntu so I needed to install back everything.
Nearly all is done but when I start a new project with Symfony on PhpStorm, and when I do a composer install or composer update in the terminal I have an error that I don't know how to treat.
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
Did you forget a "use" statement? in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52
Stack trace:
#0 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(284): Symfony\Component\Config\Util\XmlUtils::loadFile('/var/www/html/E...', Array)
#1 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/var/ww
w/html/E...')
#2 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(57): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xm
l')
#3 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/
Config/Util/XmlUtils.php on line 52
I tried installing composer following this link
but I don't recall using such practice.
So I cannot move forward with my project because I can't get past composer... if anyone knows why and could give me a step-by-step approach that would be truly appreciated.
Thank you
PHP's DOMDocument library is not installed. You need to install it. Try -
sudo apt-get install php-dom

Bootstrap 3 in Symfony2

I'm trying to use bootstrap in my symfony project . But when I configure json file through this error. However I have included
new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle()
I have looked up from here
error:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Class 'Braincrafted\Bundle\BootstrapBundle\BraincraftedBo
otstrapBundle' not found in /home/kanat/Public/bootstrap/app/AppKernel.php
I have looked up from here
like the error says, its having touble clearing the cache, that could be a directory permission issue,set the folder permissions to read write and execute and then try to clear cache again, (in linux it would be sudo chmod -R 777 *)

symfony2.7 FOS USER error on prod

I just try to connect on my website using the app.php with
new AppKernel('prod', false);
and i got an error 500 when login and stay blocked on /login_check.
But if i change it to:
new AppKernel('prod', true);
its work with no problem!!
So i check the prod.log of symfony and here what i found:
[2015-06-24 13:47:11] php.CRITICAL: Fatal Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php') {"type":64,"file":"/var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php","line":209,"level":6143,"stack":[{"function":"getProxyDefinition","type":"->","class":"Doctrine\\Common\\Proxy\\AbstractProxyFactory","file":"/var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php","line":119,"args":[]},{"function":"getProxy","type":"->","class":"Doctrine\\Common\\Proxy\\AbstractProxyFactory","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php","line":2677,"args":[]},{"function":"createEntity","type":"->","class":"Doctrine\\ORM\\UnitOfWork","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php","line":138,"args":[]},{"function":"hydrateRowData","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\SimpleObjectHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php","line":48,"args":[]},{"function":"hydrateAllData","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\SimpleObjectHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php","line":140,"args":[]},{"function":"hydrateAll","type":"->","class":"Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php","line":756,"args":[]},{"function":"load","type":"->","class":"Doctrine\\ORM\\Persisters\\BasicEntityPersister","file":"/var/www/html/crm/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php","line":196,"args":[]},{"function":"findOneBy","type":"->","class":"Doctrine\\ORM\\EntityRepository","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php","line":68,"args":[]},{"function":"findUserBy","type":"->","class":"FOS\\UserBundle\\Doctrine\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Model/UserManager.php","line":92,"args":[]},{"function":"findUserByUsername","type":"->","class":"FOS\\UserBundle\\Model\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Model/UserManager.php","line":108,"args":[]},{"function":"findUserByUsernameOrEmail","type":"->","class":"FOS\\UserBundle\\Model\\UserManager","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Security/EmailUserProvider.php","line":21,"args":[]},{"function":"findUser","type":"->","class":"FOS\\UserBundle\\Security\\EmailUserProvider","file":"/var/www/html/crm/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php","line":45,"args":[]},{"function":"loadUserByUsername","type":"->","class":"FOS\\UserBundle\\Security\\UserProvider","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/DaoAuthenticationProvider.php","line":83,"args":[]},{"function":"retrieveUser","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\Provider\\DaoAuthenticationProvider","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php","line":70,"args":[]},{"function":"authenticate","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\Provider\\UserAuthenticationProvider","file":"/var/www/html/crm/app/cache/prod/classes.php","line":3077,"args":[]},{"function":"authenticate","type":"->","class":"Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php","line":96,"args":[]},{"function":"attemptAuthentication","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall\\UsernamePasswordFormAuthenticationListener","file":"/var/www/html/crm/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php","line":146,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall\\AbstractAuthenticationListener","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2992,"args":[]},{"function":"onKernelRequest","type":"->","class":"Symfony\\Component\\Security\\Http\\Firewall","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2245,"args":[]},{"function":"call_user_func:{/var/www/html/crm/app/cache/prod/classes.php:2245}","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2245,"args":[]},{"function":"doDispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2178,"args":[]},{"function":"dispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","file":"/var/www/html/crm/app/cache/prod/classes.php","line":2339,"args":[]},{"function":"dispatch","type":"->","class":"Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3083,"args":[]},{"function":"handleRaw","type":"->","class":"Symfony\\Component\\HttpKernel\\HttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3056,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\HttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":3207,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel","file":"/var/www/html/crm/app/bootstrap.php.cache","line":2429,"args":[]},{"function":"handle","type":"->","class":"Symfony\\Component\\HttpKernel\\Kernel","file":"/var/www/html/crm/web/app.php","line":28,"args":[]},{"function":"{main}","file":"/var/www/html/crm/web/app.php","line":0,"args":[]}]} []
[2015-06-24 13:47:11] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php')" at /var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php line 209 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Compile Error: require(): Failed opening required '/var/www/html/crm/app/cache/prod/doctrine/orm/Proxies/__CG__dmMembreBundleEntityMembreAuth.php' (include_path='.:/usr/share/pear:/usr/share/php') at /var/www/html/crm/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:209)"} []
Off course i first think about chmod on my cache directory but evrything is on 777 recursivly... and working like a charm if i dont set the debug on false!
So if anyone have an idea...
Found the answer
Before go on prod, we need to warm the prod cache to completely delete so before delete of the cache folder we have to execute this command:
php app/console cache:warmup --env=prod --no-debug
and after:
rm -rf app/cache/*; chmod -R 777 app/cache
And that's all folks!

Resources