Question

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 saving. I must have overridden some base class property that gets set after reading in the column names from the database.

Was it helpful?

Solution

Use phpDoc's @property tag:

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

OTHER TIPS

Got it working, have to proceed property names with $

/**
  *   @property string $Name
  *   @property int $UserID
  */
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top