Skip to content

Commit 4ceee74

Browse files
author
Caitlin Bales (MSFT)
committed
Fix for "Json" type
1 parent 77fe86e commit 4ceee74

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Templates/PHP/Model/ComplexType.php.tt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,22 @@ class <#=complex.Name.ToUpperFirstChar()#>
9696
public function get<#=property.Name.ToCheckedCase()#>()
9797
{
9898
if (array_key_exists("<#=property.Name.ToCamelize()#>", $this->propDict)) {
99+
<#
100+
if (property.Type.GetTypeString() == "Json") {
101+
#>
102+
return $this->_propDict["<#=property.Name.ToCamelize()#>"];
103+
<#
104+
} else {
105+
#>
99106
if (is_a($this->propDict["<#=property.Name.ToCamelize()#>"], '<#=property.Type.GetTypeString()#>')) {
100107
return $this->propDict["<#=property.Name.ToCamelize()#>"];
101108
} else {
102109
$this->propDict["<#=property.Name.ToCamelize()#>"] = new <#=property.Type.GetTypeString()#>($this->propDict["<#=property.Name.ToCamelize()#>"]);
103110
return $this->propDict["<#=property.Name.ToCamelize()#>"];
104111
}
112+
<#
113+
}
114+
#>
105115
}
106116
return null;
107117
}

Templates/PHP/Model/EntityType.php.tt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,22 @@ class <#=entity.Name.ToCheckedCase()#>
7575
public function get<#=property.Name.ToCheckedCase()#>()
7676
{
7777
if (array_key_exists("<#=property.Name.ToCamelize()#>", $this->_propDict)) {
78+
<#
79+
if (property.Type.GetTypeString() == "Json") {
80+
#>
81+
return $this->_propDict["<#=property.Name.ToCamelize()#>"];
82+
<#
83+
} else {
84+
#>
7885
if (is_a($this->_propDict["<#=property.Name.ToCamelize()#>"], '<#=property.Type.GetTypeString()#>')) {
7986
return $this->_propDict["<#=property.Name.ToCamelize()#>"];
8087
} else {
8188
$this->_propDict["<#=property.Name.ToCamelize()#>"] = new <#=property.Type.GetTypeString()#>($this->_propDict["<#=property.Name.ToCamelize()#>"]);
8289
return $this->_propDict["<#=property.Name.ToCamelize()#>"];
8390
}
91+
<#
92+
}
93+
#>
8494
}
8595
return null;
8696
}

0 commit comments

Comments
 (0)