开发者

How do I set columns/members in Kohana ORM v3

class Model_User extends ORM {
  // columns: UserID, Name
  // public $Name ; // this didn't work
}

Currently I create an object: $user = new Model_User() ; and access columns like:

 $user->Name = 'My Name';

I'd like to have my IDE show me all the columns in the data model to avoid misspellings and to now right away what fields I can use.

How do I update my model to give my IDE the list of possible columns/properties? I tried adding the properties to the class but that broke the ORM() and no longer allowed sa开发者_Python百科ving. I must have overridden some base class property that gets set after reading in the column names from the database.


Use phpDoc's @property tag:

/**
   @property  string   Name     username
   @property  int      UserID   user ID (primary key)
 */
class Model_User extends ORM {
// ...
}


Got it working, have to proceed property names with $

/**
  *   @property string $Name
  *   @property int $UserID
  */
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜