2016-11-28 73 views
2

我已經測試symfony3與Eclipse和NetBeans IDE中,我仍然不設法得到自動完成自動完成的symfony ...如何使用Eclipse和/或NetBeans的

這裏是我的控制器:

<?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); 

    } 

} 

在Eclipse中我能有這個$(後來我得到儘可能選擇)自動完成,但我從來沒有得到帶有自動完成的渲染方法..

我看着這個Preserving auto-completion abilities with Symfony2 Dependency Injection但我無法得到它的工作。

任何人都可以幫我以我的例子嗎?

回答

0

試試這個:

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); 
} 

也許你需要調整的評論暗示,但它應該工作。

但我的建議是:用symfony的插件獲取PhpStorm(我知道這是不是免費的,但給審判一個嘗試,決定它是否值得)

+0

謝謝!它在Eclipse上效果很好。感謝您花時間回答我。瘋狂的事情是我接近那個,但從來沒有成功。大thx! – joe

相關問題