Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i fix the symfony cache generated files

I have just started working with symfony2 and I have a huge road block that I can't seem to figure it out. I have create a new class called AppKernel to register my Bundles,etc.

class AppKernel extends Kernel
{

public function registerBundles()
{
    $bundles=[
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new mdBundle\mdBundle(),
];
    return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
    $loader->load(function ($container) {
        $container->loadFromExtension('framework', array(
            'secret' => 'some secret here',
            'router' => array(
                'resource' => '%kernel.root_dir%/config/routing.yml'
            ),
            'templating' => array('engines' => array('php'))
        ));
    });
}

}

My front controller looks like this:

include_once(__DIR__ . '/../../app/bootstrap.php');

/**
 * @var Composer\Autoload\ClassLoader $loader
 */
$loader = require '../../app/vendor/autoload.php';

Debug::enable();

$kernel = new AppKernel('dev', true);
//$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

The error msg that i get is the following:Type error: Argument 4 passed to Symfony\Component\HttpKernel\HttpKernel::__construct() must implement interface Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface, boolean given, called in /var/www/html/app/classes/cache/dev/classesDevDebugProjectContainer.php on line 367 I am just not sure how this file gets created with the wrong value(the value is false"boolean") for argument 4.

Here is my composer.json file.

"require": {
        "php": ">=7.0",
        "symfony/console":"v3.0.0",
        "mobiledetect/mobiledetectlib": "2.5.7",
        "zendframework/zend-db": "2.2.5",
        "symfony/dependency-injection": "v3.0.0",
        "symfony/config": "v3.0.0",
        "symfony/yaml": "v2.3.5",
        "phpmailer/phpmailer" : "v5.2.9",
        "smarty/smarty" : "3.1.12",
        "knplabs/knp-snappy": "*",
        "twbs/bootstrap": "3.3.6",
        "phpoffice/phpexcel": "*",
        "moredirect/service": "dev-master",
        "symfony/var-dumper": "2.*",
        "gongo/merciful-polluter": "^0.0.3",
        "solarium/solarium": "^3.5",
        "symfony/framework-bundle": "v3.0.0",
        "symfony/form": "3.0.0",
        "doctrine/doctrine-bundle": "1.6.2",
        "symfony/monolog-bundle": "2.10.0",
        "symfony/security-bundle": "3.0.0",
        "symfony/finder": "3.0.0",
        "symfony/filesystem": "3.0.0",
        "symfony/web-profiler-bundle": "3.0.0",
        "sensio/framework-extra-bundle": "v3.0.0",
        "sensio/distribution-bundle": "3.0.0"
    }

Any help is greatly appreciated. thank you.

like image 823
zeid10 Avatar asked Jun 30 '16 20:06

zeid10


People also ask

How to clear the cache in symfony?

To clear the cache you can use the bin/console cache:pool:clear [pool] command. That will remove all the entries from your storage and you will have to recalculate all the values. You can also group your pools into "cache clearers".

What is a cache component?

The Cache component provides features covering simple to advanced caching needs. It natively implements PSR-6 and the Cache Contracts for greatest interoperability. It is designed for performance and resiliency, ships with ready to use adapters for the most common caching backends.


1 Answers

Turns out i was missing the following line in the composer.json file:

"symfony/http-kernel":"3.0.0"

After i added it is working fine. thank you for all the comments.

like image 125
zeid10 Avatar answered Sep 21 '22 16:09

zeid10