What is the best way to auto generate getters and setters for a class in php? [closed]
With Eclipse go to Preferences -> PHP -> Editor -> Templates -> New and use something like this:
/** * Method to get the ${PropertyName} * * @return ${ReturnType} return the ${PropertyName}. * * @since __DEPLOY_VERSION__*/public function get${MethodName}() { return $$this->${PropertyName};}/** * Method to set the ${PropertyName} * * @return boolean True on success and false on failed case * * @since __DEPLOY_VERSION__*/public function set${MethodName}($$value) { $$this->${PropertyName} = $$value;}
To use the template type its name and press ctrl+space - a context menu should also automatically appear when you type the name.