Search code examples
cachingsymfonycrudhttp-caching

symfony2 crud & http cache


I'm using Symfony2 and I have a ReaderBundle that has an Rss entity.

I'm created CRUD for this entity.

php app/console generate:doctrine:crud --entity=RSSReaderBundle:Rss --format=annotation --with-write

All was well, before I connected Cache.

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppCache.php';
require_once __DIR__.'/../app/AppKernel.php';

Debug::enable();

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

And then when i'm trying to delete some record, i take this error:

No route found for "POST /rss/delete/30": Method Not Allowed (Allow: DELETE)
405 Method Not Allowed

I created a form that clearly indicates the method:


private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('rss_delete', array('id' => $id)))
            ->setMethod("DELETE")
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }

I have not found the problem. Help please


Solution

  • we must remove the string with comment "THAT STRING IS MAIN PROBLEM". Cache is working all the same. And CRUD working right