Skip to content

Commit a117848

Browse files
authored
Check whether this type is a generated model type or a PHP type (#220)
1 parent 4dc6f2f commit a117848

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Templates/PHP/Model/ComplexType.php.tt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,13 @@ foreach(var property in complex.Properties.Where(prop => prop.Type.GetTypeString
128128
public function get<#=propertyName.ToCheckedCase()#>()
129129
{
130130
if (array_key_exists("<#=property.Name.ToCamelize()#>", $this->_propDict)) {
131+
<#
132+
// Check whether this type is a generated model type or a PHP type
133+
if (property.Type.GetTypeString()[0] == '\\') { #>
134+
if (is_a($this->_propDict["<#=property.Name.ToCamelize()#>"], "<#=property.Type.GetTypeString()#>")) {
135+
<# } else { #>
131136
if (is_a($this->_propDict["<#=property.Name.ToCamelize()#>"], "<#=targetNamespace#>\<#=property.Type.GetTypeString()#>")) {
137+
<# } #>
132138
return $this->_propDict["<#=property.Name.ToCamelize()#>"];
133139
} else {
134140
<# if (property.Type.GetTypeString() == "\\GuzzleHttp\\Psr7\\Stream") { #>

0 commit comments

Comments
 (0)