2

I have tested symfony3 with both eclipse and netbeans IDE and I still don't manage to get autocompletion...

Here is my controller:

<?php

// src/OC/PlatformBundle/Controller/AdvertController.php
namespace OC\PlatformBundle\Controller;

// N'oubliez pas ce use :
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Symfony\Component\HttpFoundation\Response;

class AdvertController extends Controller
{

  public function indexAction()
  {

    $content = $this->get('templating')->render('OCPlatformBundle:Advert:index.html.twig');

    return new Response($content);

  }

}

In Eclipse I can have autocomplete for $this (then I have get as a choice), but I never get the render method with autocompletion..

I looked at this Preserving auto-completion abilities with Symfony2 Dependency Injection but I couldn't get it working.

Can anyone help me with my example please?

Community
  • 1
  • 1
joe
  • 23
  • 2

1 Answers1

0

Try this:

public function indexAction()
{
    /** @var $twig \Symfony\Bundle\TwigBundle\TwigEngine */
    $twig = $this->get('templating');
    $content = $twig->render('OCPlatformBundle:Advert:index.html.twig');;

    return new Response($content);
}

Maybe you need to adjust the comment hint but it should work.

But my advice would be: Get PhpStorm with the symfony Plugin (i know it's not free but give the trial a try and decide if it's worth it)

Joe
  • 2,356
  • 10
  • 15
  • Thanks! it works great on Eclipse. Thank you for taking the time to answer me. The crazy thing is i was close to that but never succeed. Big thx! – joe Nov 28 '16 at 15:55