views:

2517

answers:

7

Hi!, I'm using Zend Studio for Eclipse (Linux), and I'm trying to generate getter and setters methods in a PHP class.

I try to do this: http://files.zend.com/help/Zend-Studio-Eclipse-Help/creating_getters_and_setters.htm but I haven't "Generate Getters and Setters" option in Source Menu, it's missed!

Could u help me? Thanks!

+3  A: 

It has to be there under the menu - source in Eclipse. Could you provide a snapshot of your Eclipse to verify. EDITED: I guess it is not possible to generate getters and setters automatically in your version, though you would be able to create templates for the same and use it as per your requirements. Omnipotent (0 seconds ago)

Omnipotent
A: 

If there is a 'Refactor' menu, check in there as well. A lot of those methods have been moved to the 'Refactor' menu in later versions of eclipse and if Zend has updated recently and not updated it's documentation, the items may have encountered an undocumented move.

workmad3
A: 

Here is the screen!

As u can see it's disappeared!

A: 

Ops! here is the link http://www.postimage.org/image.php?v=gxeP2Fi

Use comments. :)
Till
A: 

@workmad3 Under 'Refactor' I only have 'Rename' option :(

A: 

@Omnipotent It's Zend Studio v6.01, "generate getters and setters" feature should be available. I can see doc about it in Help Contents.

By the way i'll try updating to v6.1

Thanks anyway!

EDITED: Templates and Code Assist works fine but are not usefull as "Generate getters and setters".

+2  A: 

Like Omnipotent say, you can use templates to do this. Here what I use:

/**
 * @var ${PropertyType} 
 */
private $$m${PropertyName};
${cursor}

/**
 *  Getter for ${PropertyName}
 *
 * @author ${user}
 * @since ${date} ${time}
 * @return ${PropertyType} private variable $$m_${PropertyName}
 */
public function get${PropertyName}() 
{
  return $$this->m_${PropertyName};
}

/**
 * Setter for ${PropertyName}
 *
 * @author ${user}
 * @since ${date} ${time}
 * @param ${PropertyType} $$Value
*/
public function set${PropertyName}($$Value) 
{
  $$this->m_${PropertyName} = $$Value;
}

To create the template just go to the preferences. Then in PHP/Templates you will have your list of templates.

Eric Hogue