File tree Expand file tree Collapse file tree 3 files changed +15
-10
lines changed
src/GraphODataTemplateWriter/CodeHelpers/PHP Expand file tree Collapse file tree 3 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ foreach(var property in complex.Properties.Where(prop => prop.Type.GetTypeString
5757 {
5858 if (array_key_exists("<#=property.Name.ToCamelize()#>", $this->_propDict)) {
5959<#
60- if (property.Type.GetTypeString() == "datetime ") {
60+ if (property.Type.GetTypeString() == "\\DateTime ") {
6161#>
6262 return new \DateTime($this->_propDict["<#=property.Name.ToCamelize()#>"]);
6363<#
@@ -77,12 +77,12 @@ foreach(var property in complex.Properties.Where(prop => prop.Type.GetTypeString
7777 *
7878 * @param <#=property.Type.GetTypeString()#> $val The value of the <#=property.Name#>
7979 *
80- * @return null
80+ * @return <#=complex.Name.ToCheckedCase()#>
8181 */
8282 public function set<#=property.Name.ToCheckedCase()#>($val)
8383 {
8484<#
85- if (property.Type.GetTypeString() == "datetime ") {
85+ if (property.Type.GetTypeString() == "\\DateTime ") {
8686#>
8787 $this->_propDict["<#=propertyName#>"]
8888 = $val->format(\DateTime::ISO8601) . "Z";
@@ -122,7 +122,7 @@ foreach(var property in complex.Properties.Where(prop => prop.Type.GetTypeString
122122 *
123123 * @param <#=property.Type.GetTypeString()#> $val The value to assign to the <#=property.Name#>
124124 *
125- * @return The <#=complex.Name.ToUpperFirstChar()#>
125+ * @return <#=complex.Name.ToCheckedCase()#> The <#=complex.Name.ToUpperFirstChar()#>
126126 */
127127 public function set<#=property.Name.ToCheckedCase()#>($val)
128128 {
Original file line number Diff line number Diff line change @@ -42,7 +42,13 @@ class <#=entity.Name.ToCheckedCase()#> extends Entity
4242 */
4343 function __construct($propDict = array())
4444 {
45+ <#
46+ if (!(entity.Name.ToCheckedCase() == "Entity")) {
47+ #>
4548 parent::__construct();
49+ <#
50+ }
51+ #>
4652 $this->_propDict = $propDict;
4753 }
4854
@@ -155,7 +161,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
155161 {
156162 if (array_key_exists("<#=property.Name.ToCamelize()#>", $this->_propDict)) {
157163<#
158- if (property.Type.GetTypeString() == "datetime ") {
164+ if (property.Type.GetTypeString() == "\\DateTime ") {
159165#>
160166 return new \DateTime($this->_propDict["<#=property.Name.ToCamelize()#>"]);
161167<#
@@ -180,7 +186,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
180186 public function set<#=property.Name.ToCheckedCase()#>($val)
181187 {
182188<#
183- if (property.Type.GetTypeString() == "datetime ") {
189+ if (property.Type.GetTypeString() == "\\DateTime ") {
184190#>
185191 $this->_propDict["<#=property.Name.ToCamelize()#>"]
186192 = $val->format(\DateTime::ISO8601) . "Z";
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public static string GetTypeString(this OdcmType @type)
4242 {
4343 case "String" :
4444 case "Json" :
45+ case "Guid" :
4546 return "string" ;
4647 case "Int8" :
4748 case "Int16" :
@@ -50,16 +51,14 @@ public static string GetTypeString(this OdcmType @type)
5051 return "int" ;
5152 case "Double" :
5253 return "float" ;
53- case "Guid" :
54- return "UUID" ;
5554 case "DateTimeOffset" :
5655 case "Date" :
57- return "datetime " ;
56+ return "\\ DateTime " ;
5857 case "Boolean" :
5958 return "bool" ;
6059 case "Binary" :
6160 case "Stream" :
62- return "bytes " ;
61+ return "\\ GuzzleHttp \\ Psr7 \\ Stream " ;
6362 default :
6463 return @type . Name . ToUpperFirstChar ( ) ;
6564 }
You can’t perform that action at this time.
0 commit comments