Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Zend Framework view helper code completion in Eclipse (Aptana Studio 3)?

I am using Aptana Studio 3 (built on Eclipse) to edit my Zend Framework application. When I am editing a view script, I would like my IDE to provide code completion / auto-complete.

<?php echo $this->form...

Being that the view helper functions are not exactly classes that are instantiated, I don't get this sort of functionality out of the box. How can I go about adding this sort of functionality to Eclipse?

like image 757
Andrew Avatar asked Jun 13 '11 22:06

Andrew


2 Answers

The only thing you can really do is use variable type hints, for example

<?php
/* @var $form Zend_Form */
$form = $this->form;

You will then get code completion for $form properties and methods.

View helpers can mostly be treated the same, eg

<?php
/* @var $headLinkHelper Zend_View_Helper_HeadLink */
$headLinkHelper = $this->getHelper('HeadLink');
like image 185
Phil Avatar answered Sep 21 '22 22:09

Phil


Since you are using Aptana Studio, and not PDT, I'll add to the comment I posted above (as an answer).

The correct syntax in Aptana Studio is:

/**
 * @var Foobar 
 */ 
$obj; // You have to call the variable here (redundant call...)
$obj-> // will code assist the FooBar functions.

That redundant call is a deal breaker (IMHO), so I'm working on having additional support, like with the PDT special @var syntax suggested at @Phil's answer).

/* @var $obj Foobar */
$obj-> // will code assist the FooBar functions.

In any case, for backward compatibility, both will be supported in the Studio's next release.

Hope that helps

like image 34
sgibly Avatar answered Sep 21 '22 22:09

sgibly