Can you help me in this question ... I use Symfont 2.8 with EasyAdminBundle. I was used this manual to install - symfony2-admin-panel-in-30-seconds.
Admin panel works fine, but when I try to create my (not-admin) class, I get an error : Cannot redeclare class Symfony\Component\DependencyInjection\ContainerAwareInterface in /var/www/html/Legendcorp/app/cache/dev/classes.php on line 6568
For example: I created the class in /src/AppBundle/Controller/APIController.php
namespace AppBundle\Controller;
use JavierEguiluz\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class FormController extends BaseAdminController{
/**
* @Route("/form/save", name="save")
*/
public function formAction(Request $request){
}
}
but when I try to apply to this class, I get an error. -
Fatal error: Cannot redeclare class Symfony\Component\DependencyInjection\ContainerAwareInterface in /var/www/html/Legendcorp/app/cache/dev/classes.php on line 6568
If I clear the cache (rm -rf app/cache/*), it will works, but only as long as you do not contact the admin panel.
This is my composer.json file:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" },
"files": [ "app/AppKernel.php" ]
},
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "1.3@dev",
"vich/uploader-bundle": "^0.14.0"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"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"
},
"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"
}
}
}
Please, can you help me?
The blog post you followed is very nice, but for things like installing the bundle, I always recommend to follow the official documentation. In this case: Chapter 1. Installation from EasyAdmin's docs.
Regarding the
ContainerAwareInterface
error, I'd say that it has nothing to do with the bundle. We don't use that interface anywhere and we don't use theContainerAware
class either. If you remove the bundle, does the Symfony application work without errors?