php-symfony.model_generic.mustache Maven / Gradle / Ivy
class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}
{
{{#vars}}{{>model_variables}}
{{/vars}}
/**
* Constructor
* @param mixed[] $data Associated array of property values initializing the model
*/
public function __construct(array $data = null)
{
{{#parentSchema}}
parent::__construct($data);
{{/parentSchema}}
{{#vars}}
$this->{{name}} = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}};
{{/vars}}
}
{{#vars}}
/**
* Gets {{name}}.
*
* @return {{{vendorExtensions.x-commentType}}}{{^required}}|null{{/required}}
*/
public function {{getter}}()
{
return $this->{{name}};
}
/**
* Sets {{name}}.
*
* @param {{{vendorExtensions.x-commentType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}
*
* @return $this
*/
public function {{setter}}({{#vendorExtensions.x-parameterType}}{{vendorExtensions.x-parameterType}} {{/vendorExtensions.x-parameterType}}${{name}}{{^required}} = null{{/required}})
{
$this->{{name}} = ${{name}};
return $this;
}
{{/vars}}
}