Skip to content

Commit 6137f03

Browse files
committed
Fixed code
1 parent b03a9a1 commit 6137f03

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

resources/fileTemplates/internal/Magento Data Model.php.ft

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS} && $has
5555
#end
5656
public function get$propertyUpperCamel(): ?$propertyType
5757
{
58-
#set($propertyCast = "#if($propertyType != 'string')($propertyType)#{else}#end")
58+
#if($propertyType == 'string')
59+
return $this->getData(self::$propertyUpperSnake);
60+
#{else}
5961
return $this->getData(self::$propertyUpperSnake) === null ? null
60-
: $propertyCast $this->getData(self::$propertyUpperSnake);
62+
: ($propertyType) $this->getData(self::$propertyUpperSnake);
63+
#end
6164
}
6265

6366
#if ($hasInterface)

testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public function setIdProperty(?int $idProperty): void
4343
*/
4444
public function getSampleProperty(): ?string
4545
{
46-
return $this->getData(self::SAMPLE_PROPERTY) === null ? null
47-
: $this->getData(self::SAMPLE_PROPERTY);
46+
return $this->getData(self::SAMPLE_PROPERTY);
4847
}
4948

5049
/**

0 commit comments

Comments
 (0)