Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Freeze on Twig render #346

Closed
dewos opened this Issue · 9 comments

3 participants

@dewos

Hi, I have integrated FOSRestBundle with Symfony and it works pretty fine (thanks!), but if I want the following in a twig template:

   {% render "MyBundle:Entry:new" %}

the server freeze down (no error or rendering) and it needs a forced reboot.

The controller is pretty basic:

/**

  • @View
  • @Route("/entries")
    /
    class EntryController extends Controller
    {
    /
    *

    • @Secure(roles="ROLE_USER")
    • @Get("/new", name="new_entry")
      */
      public function newAction()
      {
      $form = $this->createForm(new EntryType());

      return array(
      'form' => $form->createView(),
      );
      }

A call on [GET] "http://localhost/pj/web/app_dev.php/entries/new" works fine, the problem is only with the "rendering" (sub-request calls) in twig template. Any ideas?

@dewos

Ok, found it. The problem shows up only when @View is set globally on top in the class definition.

@lsmith77
Owner

i am sure there must be some error reported somewhere. there isnt anything that could cause the server to freeze like you describe inside the this bundle that i can think of.

@lsmith77 lsmith77 closed this
@dewos

Sorry for the delay. The dev.log loops on (again and again and again)

[2013-02-24 23:55:02] security.INFO: No expression found; abstaining from voting. [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.view" to listener "FOS\RestBundle\EventListener\ViewResponseListener::onKernelView". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "FOS\RestBundle\EventListener\BodyListener::onKernelRequest". [] []
[2013-02-24 23:55:02] event.DEBUG: Notified event "kernel.request" to listener "Nelmio\ApiDocBundle\EventListener\RequestListener::onKernelRequest". [] []

The @View annotation not in class but in each action methods fixes the problem, anyway.

@lsmith77
Owner

yes .. the view annotation is a method level and not a class level annotation.

@stof
Owner

@lsmith77 you should add @Target("METHOD") in its phpdoc so that the annotation reader enforces it: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/PostPersist.php#L24

@dewos

Ok thanks.

@lsmith77
Owner

good point .. @Dewos can you go through all of the FOSRestBundle annotations and add those @Target annotations with METHOD/CLASS/PROPERTY as needed?

@dewos

Sorry @lsmith77 , I've only now read your reply. Do you still need it?

@lsmith77
Owner

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.