I'm working on symfony 2.8 project and I'm new in it. Now I try to upgrade it to the newest version. I found the rector package for update the symfony (rector-prefixed exactly, for older version). I've install it and try to run like it is in documentation: https://github.com/rectorphp/rector, and got this error in the console:
'vendor' is not recognized as an internal or external command,
operable program or batch file.
I've don't found any information about errors like this so I think it could be a problem connect with console error. When I try to write any command for example:
php app/console list
I've got this exception back:
#!/usr/bin/env php
[Symfony\Component\Console\Exception\LogicException]
An option named "connection" already exists.
I don't know exactly where to looking for a problem. I will add my console file code and composer.json, maybe someone have same problem as me.
#!/usr/bin/env php
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
set_time_limit(0);
require __DIR__.'/autoload.php';
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
if ($debug) {
Debug::enable();
}
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"Tixi\\": "src/Tixi/"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
"php": "~7.4",
"ext-json": "*",
"apy/breadcrumbtrail-bundle": "1.3.*",
"composer/ca-bundle": "~1.2.7",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-migrations-bundle": "1.3.*",
"doctrine/orm": "^2.4.8",
"egulias/email-validator": "~1.2",
"friendsofsymfony/oauth-server-bundle": "1.5.*",
"friendsofsymfony/rest-bundle": "1.7.*",
"incenteev/composer-parameter-handler": "~2.0",
"jms/serializer-bundle": "1.5.*",
"knplabs/knp-snappy-bundle": "1.5.*",
"mediaburst/clockworksms": "2.0.*",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/monolog-bundle": "^3.0.2",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/symfony": "2.8.*",
"twig/extensions": "1.5.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"rector/rector-prefixed": "^0.9.31",
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "7.4"
},
"sort-packages": true,
"discard-changes": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.8-dev"
}
}
}
I solved already the problem. First the problem with Rector was with the command. I don't know exactly why but normal command don't work with my project. In Rector documentation there is:
vendor/bin/rector
command but in my project there works only:
php bin/rector
So this problem was solved. Next I have an issue with any other command form command line. There was a Logic exception. But I handle with this after upgrade the Symfony from 2.8 to 3.x. So I think there was conflict between the oldest version of Symfony and the php 7.4 version.