Netbeans自动完成方法Zend模型类 [英] Netbeans AutoComplete Methods Zend Model Classes
问题描述
我有以下模型类,但是netbeans 7.0.1自动完成功能不适用于行类.
I have the following models classes however netbeans 7.0.1 autocomplete doesn't work for row classes.
模型类:
class Application_Model_DbTable_Payments extends Zend_Db_Table_Abstract {
protected $_name = 'payments';
protected $_rowClass = 'Application_Model_Payment';
}
行级:
class Application_Model_Payment extends Zend_Db_Table_Row_Abstract {
public function setIdentifier($identifier = null){
return $this->identifier = $identifier;
}
}
代码:
$paymentsModel = new Application_Model_DbTable_Payments();
$payment = $paymentsModel->find(1)->current();// return an Application_Model_Payment Object
$payment->setIdentifier();//doesn't appear on netbeans autocomplete, only Zend_Db_Table_Row methods appers
如何使netbeans显示行类方法?
How could I make netbeans show row class methods?
推荐答案
因为netbeans大量使用docblock注释(在这种情况下,find是继承的方法),除非您将返回类型明确地放在方法的注释块中,Netbeans真的不知道该怎么做.
Because netbeans uses heavily the docblock comments (and in this case find is an inherited method), unless you explicitly put the return type in the comment block for a method, Netbeans hasn't really got a clue what to do.
尽管您可以通过添加如下代码块来帮助它:
You can give it a hand though by doing adding a block like this:
/* @var $variable ClassName */
就像在您的代码中一样
$paymentsModel = new Application_Model_DbTable_Payments();
/* @var $payment Application_Model_Payment */
$payment = $paymentsModel->find(1)->current();// return an Application_Model_Payment Object
$payment->setIdentifier();
它将提示" netbeans变量是什么.
It will 'hint' netbeans as to what the variable is.
更新:这是从类/方法声明中执行此操作的示例.在此示例中,$ something是Application_Model_Token的实例.
UPDATE: Here is an example of doing it from the class/method declaration. In this example $something is instantiation of Application_Model_Token.
class User
{
/**
* @return Application_Model_Token
*/
public function reset()
{
//Some code etc
return $something
}
}
这篇关于Netbeans自动完成方法Zend模型类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!