Andrew
Andrew

Reputation: 238717

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?

Upvotes: 6

Views: 1838

Answers (2)

sgibly
sgibly

Reputation: 3838

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

Upvotes: 1

Phil
Phil

Reputation: 164795

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

Upvotes: 5

Related Questions