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