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.
Related
I am learning to use symfony and php for my studies. My project requires me to update symfony to version 3.0. *. When switching from version 2.8 to 3.0. * With the composer update command, I arrive at an error in the clear cache. I have already looked on different forums but I cannot find a solution to my problem.
I give you in the rest of the post the code of the files which I think are problematic.
I have this error while updating composer:
command prompt error
and my Kernel is :
<?php
declare(strict_types=1);
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function __construct($environment, $debug)
{
date_default_timezone_set('Europe/Paris');
parent::__construct($environment, $debug);
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return \dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
return \dirname(__DIR__).'/var/logs';
}
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Aaeima\AnnuaireBundle\AaeimaAnnuaireBundle(),
new Aaeima\SignInBundle\AaeimaSignInBundle(),
new Aaeima\RegisterBundle\AaeimaRegisterBundle(),
new Aaeima\ProfileBundle\AaeimaProfileBundle(),
new Aaeima\AdminBundle\AaeimaAdminBundle(),
];
if (\in_array($this->getEnvironment(), ['dev', 'test'])) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
/*$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');*/
}
}
And my .json is :
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.4.8",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"twitter/bootstrap": "*",
"components/jquery": "1.9.*#dev",
"friendsofsymfony/user-bundle": "dev-master",
"symfony/phpunit-bridge": "^5.0",
"symfony/monolog-bundle": "^2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/distribution-bundle": "^5.0"
},
"require-dev": {
"sensio/generator-bundle":"^3.0"
},
"scripts": {
"post-install-cmd": [
"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-update-cmd": [
"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"
]
},
"config": {
"bin-dir": "bin",
"component-dir": "web/components",
"component-baseurl": "/components"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-var-dir": "var",
"symfony-bin-dir": "bin",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
}
},
"repositories": [
{
"type": "package",
"package": {
"version": "3",
"name": "twitter/bootstrap",
"source": {
"url": "https://github.com/twitter/bootstrap.git",
"type": "git",
"reference": "master"
},
"dist": {
"url": "https://github.com/twitter/bootstrap/zipball/master",
"type": "zip"
}
}
}]
}
I have already delete the vendor and run an update but nothing change. I think my composer json is valid.
Any help is appreciated!
Based on the output and the composer file, it seems you need to require the Doctrine/DoctrineBundle package. https://github.com/doctrine/DoctrineBundle
Including that in the composer.json file and run a composer update should fix it.
I'll be as concise and precise as I can. I am thankful for all help!
My system: Symfony 3.3.8, PHP 5.6.25. IDE : PhpStorm
Error encountered :
Attempted to load class "GuzzleBundle" from namespace "EightPoints\Bundle\GuzzleBundle".
Did you forget a "use" statement for another namespace?
My other third-party bundles, KnPMenu or FOSUser, work perfectly.
All these bundles have been installed with composer require (packagist), composer update and then added in AppKernel.
This error pops up on every page of the website as soon as I add the new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),in the AppKernel.
I tried to composer dump-autoload after this process, but to no avail. I also added the bundle configuration in app/confing/config.yml.
Here are my files :
AppKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new FOS\UserBundle\FOSUserBundle(),
new AppBundle\AppBundle(),
new BaseBundle\BaseBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' .$this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__) . '/var/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle",
"BaseBundle\\": "src/BaseBundle"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" },
"files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
},
"require": {
"php": ">=5.5.9",
"components/jquery": "^3.1",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"eightpoints/guzzle-bundle": "^6.1",
"friendsofsymfony/user-bundle": "~2.0",
"incenteev/composer-parameter-handler": "^2.0",
"knplabs/knp-menu-bundle": "^2.0",
"oyejorge/less.php": "v1.7.0.14",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/assetic-bundle": "^2.8",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.3.10",
"symfony/symfony": "3.3.8",
"twbs/bootstrap": "^3.3",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
"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": {
"platform": {
"php": "5.6.25"
},
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
"symfony-web-dir": "web",
"symfony-tests-dir": "tests",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "3.3-dev"
}
}
}
I don't know why I get this error when I try to use this bundle, please help me!
Error resolved. Seems like PhpStorm excluded vendor folder.
So, vendors were not uploaded to server (wamp64/www).
Vendors were in my local project file by the way... sadly.
After a full upload of vendors in the server, everything seems to work.
Is it normal ? Have I done a begginer mistake ?
Thank you alot four your fast help guys !
I'm wondering if anyone has a solutions to this error. I have just set up PhpUnit 4.3.* and Doctrine Fixtures Bundle in a Symphony 2 project and when I run bin/phpunit -c app/ I get the following errors. These are controller test automatically generated by Symfony 2 code generator, so I figured hey should pass / be valid in any situation. I have a hunch there might be something wrong with my configuration / installation of phpunit, but I'm not sure...
Project\AdminBundle\Tests\Controller\DefaultControllerTest::testIndex
Undefined index: HTTP_HOST
For the record, my composer.json is :
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"dms/dms-filter-bundle": "*",
"jms/i18n-routing-bundle": "1.1.*",
"jms/translation-bundle": "1.1.*",
"vmelnik/doctrine-encrypt-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "2.2.*"
},
"require-dev": {
"phpunit/phpunit": "4.3.*"
},
"scripts": {
"post-install-cmd": [
"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"
],
"post-update-cmd": [
"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"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}
After some more searching around, I found out I had to add a config to phpunit.xml. For posterity, I will answer my own question.
Create a phpunit.xml file and copy the contents of phpunit.xml.dist, if you have one.
To fix the problem add
<php>
<server name='HTTP_HOST' value='http://localhost' />
</php>
...to the configuration file you just created.
More information on phpunit configuration files: http://www.testically.org/2010/08/24/best-practice-how-to-ship-phpunit-configuration/
This question is a duplicate of: PHPUnit error "undefined index : HTTP_HOST"
After updating symfony from 2.2 to 2.3, i've got new stange errors on all my pages and in my scripts:
Deprecated: Knp\Menu\Silex\Voter\RouteVoter is deprecated because of namespace, use Knp\Menu\Matcher\Voter\RouteVoter instead. in \vendor\knplabs\knp-menu\src\Knp\Menu\Silex\Voter\RouteVoter.php on line 20
and
Deprecated: Knp\Menu\Silex\RoutingExtension is deprecated, use Knp\Menu\Integration\Symfony\RoutingExtension instead. in \vendor\knplabs\knp-menu\src\Knp\Menu\Silex\RoutingExtension.php on line 15
How could I fix this ? I don't find the answer on the web.
Thank you in advance
Here is my composer.json :
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"genemu/form-bundle": "2.1.*",
"jms/security-extra-bundle": "1.5.*",
"jms/di-extra-bundle": "1.4.*",
"phpunit/phpunit": "3.7.*",
"doctrine/data-fixtures": "#dev",
"friendsofsymfony/user-bundle": "~2.0#dev",
"stof/doctrine-extensions-bundle": "dev-master",
"knplabs/gaufrette": "0.2.*#dev",
"knplabs/knp-gaufrette-bundle": "dev-master",
"jms/serializer-bundle": "0.13.*#dev",
"amazonwebservices/aws-sdk-for-php": "dev-master",
"punkave/symfony2-file-uploader-bundle": "dev-master",
"oneup/uploader-bundle": "dev-master",
"knplabs/knp-paginator-bundle": "dev-master",
"jms/debugging-bundle": "dev-master",
"winzou/console-bundle": "dev-master",
"elao/web-profiler-extra-bundle" : "dev-master",
"cybernox/amazon-webservices-bundle": ">=1.5.4",
"genemu/form-bundle": "2.2.*",
"escapestudios/wsse-authentication-bundle": "2.3.x-dev",
"rezzza/flickr-bundle": "1.0.*#dev",
"knplabs/knp-menu-bundle": "dev-master",
"genemu/form-bundle": "2.1.*",
"leaseweb/api-caller-bundle": "*",
"eo/honeypot-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"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"
],
"post-update-cmd": [
"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"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}
and my menu builder:
namespace ...\Menu;
use Knp\Menu\Matcher\Matcher;
use Knp\Menu\MenuFactory;
use Knp\Menu\Renderer\ListRenderer;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(MenuFactory $factory, array $options)
{
$menu = $factory->createItem('root');
$menu->addChild('Dashboard', array(
'route' => 'dashboard' ));
$menu->addChild('Color Scheme', array(
'uri' => 'slidescheme' ));
$menu->addChild('Questionnnaires', array(
'uri' => 'questionnaire_manage' ));
// ... add more children
return $menu;
}
}
The issue is that you're using a dev version of knplabs/menu. Edit your composer file from:
"knplabs/knp-menu-bundle": "dev-master",
to:
"knplabs/knp-menu-bundle" : "~1.1",
and the error message will go away. Note that if you're actually using dev features of knplabs/menu (like Matcher and Voter) those won't be available any more. But Symfony does not require them anyway.
It's not a good idea update your symfony version in the middle of a develpment. Actually, it's a bad idea upgrade any bundle you are using in your code (there's always exceptions, but this is the general rule).
In your case, the bundle has been refactored in this new version, so now it's not compatible with the code you have written . I'm afraid you only have two alternatives:
Adapt your code to the new requirements
Or change your composer again to use symfony 2.2 and run composer update
I strongly suggest the second option if you already have many lines of code written.
On my current symfony 2.2.1 project, I want to install TCPDFBundle (bundle for generating PDF documents)
My composer.json looks like this:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"tecnick.com/tcpdf": "*"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
So after a long time waiting for cloning, it says that time is out.
[Symfony\Component\Process\Exception\RunTimeException]
The process time-out
any help for this error?
Have you tried WhiteOctoberTCPDFBundle?
This bundle makes it easy to use the TCPDF library.
Just add this to composer.json like this
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"whiteoctober/tcpdf-bundle": "dev-master"
}
After this, follow the instructions in this link
https://github.com/whiteoctober/WhiteOctoberTCPDFBundle
Here is the answer:
COMPOSER_PROCESS_TIMEOUT=30000 php composer.phar install
It means, that you should change timeout parameter in order to be able to install this requirement.