views:

28

answers:

2

I heard you can use phpDoc to help IDE with autocomplete. Can someone show how to use it with Doctrine? For example, I have a JobTable class that extends Doctrine_Table with a bunch of methods and would like to have autocompletion when i type: Doctrine::getTable('Job')-> ... Is it possible? Is there a way to do it without phpDoc?

A: 

phpDoc comments assist autocompletion mechanism because the IDE then knows the types of the parameters.

/**
 * @param $foo FudgingBreakingImpl
 */
function doStuff($foo) { ... }

This way, the IDE knows that $foo is of type FudgingBreakingImpl, so it can autocomplete anything related to $foo, e.g. $foo->someMet.

Sjoerd
But that is just another way of saying function doStuff(FudgingBreakingImpl $foo) isn't it?
Dziamid
A: 

In your example need of your code extending a Doctrine class, your IDE will need to know where that Doctrine code is in order to know what that object looks like.

In Eclipse, this is a matter of having the Doctrine code locally on your machine and telling your Eclipse project's "Build Path" / "Include Path" where to find it.

Unless the IDE is capable of inspecting that Doctrine code, there's no way it can know things your own code is inheriting from the Doctrine class.

ashnazg