From b6ce71bb102e94501e62a52f2b46eaca267fe91b Mon Sep 17 00:00:00 2001 From: "andrii.zinkevych" Date: Wed, 20 Jan 2021 13:40:10 +0200 Subject: [PATCH 1/7] Adjusted data model generation --- .../Magento Data Model Interface.php.ft | 16 ++++-- .../internal/Magento Data Model.php.ft | 49 +++++++++++++++-- .../generation/data/DataModelData.java | 52 ++++++++++++++++++- .../generation/dialog/NewDataModelDialog.form | 17 ++++-- .../generation/dialog/NewDataModelDialog.java | 15 ++++-- .../generator/DataModelGenerator.java | 14 +++-- 6 files changed, 140 insertions(+), 23 deletions(-) diff --git a/resources/fileTemplates/internal/Magento Data Model Interface.php.ft b/resources/fileTemplates/internal/Magento Data Model Interface.php.ft index 78fde3427..2efe47430 100644 --- a/resources/fileTemplates/internal/Magento Data Model Interface.php.ft +++ b/resources/fileTemplates/internal/Magento Data Model Interface.php.ft @@ -1,5 +1,6 @@ getData(self::$propertyUpperSnake); + return $this->getData(self::$propertyUpperSnake) === null ? null + : ($propertyType) $this->getData(self::$propertyUpperSnake); } + #if ($hasInterface) /** * @inheritDoc */ - public function set$propertyUpperCamel($$propertyLowerCamel) + #else + /** + * Setter for $propertyUpperCamel. + * + * @param $propertyType|null $$propertyLowerCamel + * + * @return void + */ + #end + public function set$propertyUpperCamel(?$propertyType $$propertyLowerCamel): void { - return $this->setData(self::$propertyUpperSnake, $$propertyLowerCamel); + $this->setData(self::$propertyUpperSnake, $$propertyLowerCamel); } #end #end diff --git a/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java b/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java index 30a288057..0d1e7c64b 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java @@ -12,9 +12,18 @@ public class DataModelData { private final String fqn; private final String interfaceFQN; private final String properties; + private final boolean hasInterface; /** * Constructor. + * + * @param namespace String + * @param name String + * @param moduleName String + * @param fqn String + * @param interfaceFQN String + * @param properties String + * @param hasInterface boolean */ public DataModelData( final String namespace, @@ -22,7 +31,8 @@ public DataModelData( final String moduleName, final String fqn, final String interfaceFQN, - final String properties + final String properties, + final boolean hasInterface ) { this.namespace = namespace; this.name = name; @@ -30,29 +40,69 @@ public DataModelData( this.fqn = fqn; this.interfaceFQN = interfaceFQN; this.properties = properties; + this.hasInterface = hasInterface; } + /** + * Get Namespace. + * + * @return String + */ public String getNamespace() { return namespace; } + /** + * Get Name. + * + * @return String + */ public String getName() { return name; } + /** + * Get module name. + * + * @return String + */ public String getModuleName() { return moduleName; } + /** + * Get FQN. + * + * @return String + */ public String getFQN() { return fqn; } + /** + * Get Interface FQN. + * + * @return String + */ public String getInterfaceFQN() { return interfaceFQN; } + /** + * Get Properties. + * + * @return String + */ public String getProperties() { return properties; } + + /** + * Check if model has interface. + * + * @return boolean + */ + public boolean hasInterface() { + return hasInterface; + } } diff --git a/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.form b/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.form index fc1d36c99..9d58d7228 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.form +++ b/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.form @@ -1,9 +1,9 @@
- + - + @@ -41,7 +41,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -127,6 +127,15 @@ + + + + + + + + + diff --git a/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.java b/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.java index 07296ae35..844b0bf23 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/dialog/NewDataModelDialog.java @@ -77,6 +77,7 @@ public class NewDataModelDialog extends AbstractDialog { private JButton buttonCancel; private JTable propertyTable; private JButton addProperty; + private JCheckBox createInterface; @FieldValidation(rule = RuleRegistry.NOT_EMPTY, message = {NotEmptyRule.MESSAGE, MODEL_NAME}) @@ -137,9 +138,12 @@ private void onOK() { if (validateFormFields()) { buildNamespaces(); formatProperties(); - generateModelInterfaceFile(); generateModelFile(); - generatePreference(); + + if (isInterfaceShouldBeCreated()) { + generateModelInterfaceFile(); + generatePreference(); + } this.setVisible(false); } } @@ -206,7 +210,8 @@ private void generateModelFile() { getModuleName(), getModelFQN(), getInterfaceFQN(), - getProperties() + getProperties(), + isInterfaceShouldBeCreated() )).generate(NewDataModelAction.ACTION_NAME, true); } @@ -251,6 +256,10 @@ private void formatProperties() { } } + private boolean isInterfaceShouldBeCreated() { + return createInterface.isSelected(); + } + private String getModuleName() { return moduleName; } diff --git a/src/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGenerator.java b/src/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGenerator.java index a80e43d01..1fe146725 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGenerator.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGenerator.java @@ -21,7 +21,7 @@ import com.magento.idea.magento2plugin.magento.files.DataModel; import com.magento.idea.magento2plugin.util.GetFirstClassOfFile; import com.magento.idea.magento2plugin.util.GetPhpClassByFQN; -import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Properties; import javax.swing.JOptionPane; @@ -108,13 +108,17 @@ protected void fillAttributes(final Properties attributes) { PhpClassGeneratorUtil.getNameFromFqn(modelData.getInterfaceFQN()) ); attributes.setProperty("PROPERTIES", modelData.getProperties()); + attributes.setProperty("HASINTERFACE", Boolean.toString(modelData.hasInterface())); } private List getUses() { - return Arrays.asList( - DataModel.DATA_OBJECT, - modelData.getInterfaceFQN() - ); + final List usesList = new LinkedList<>(); + usesList.add(DataModel.DATA_OBJECT); + + if (modelData.hasInterface()) { + usesList.add(modelData.getInterfaceFQN()); + } + return usesList; } private PhpClass createModel(final String actionName) { From 5b423e86f921b34d1e990d3606acfafeeec4a1b1 Mon Sep 17 00:00:00 2001 From: "andrii.zinkevych" Date: Wed, 20 Jan 2021 13:52:21 +0200 Subject: [PATCH 2/7] Fixed code style --- .../actions/generation/data/DataModelData.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java b/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java index 0d1e7c64b..86ca4759c 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/data/DataModelData.java @@ -12,7 +12,7 @@ public class DataModelData { private final String fqn; private final String interfaceFQN; private final String properties; - private final boolean hasInterface; + private final boolean withInterface; /** * Constructor. @@ -40,7 +40,7 @@ public DataModelData( this.fqn = fqn; this.interfaceFQN = interfaceFQN; this.properties = properties; - this.hasInterface = hasInterface; + this.withInterface = hasInterface; } /** @@ -103,6 +103,6 @@ public String getProperties() { * @return boolean */ public boolean hasInterface() { - return hasInterface; + return withInterface; } } From 7ca38ac7c28dd1292ee2bdd4043104aeaa06b2ff Mon Sep 17 00:00:00 2001 From: "andrii.zinkevych" Date: Wed, 20 Jan 2021 15:18:50 +0200 Subject: [PATCH 3/7] Adjusted existed test and added test for case without interface --- .../generateDataModel/Sample.php | 10 +++-- .../Sample.php | 37 +++++++++++++++++++ .../SampleInterface.php | 16 +++++--- .../generator/DataModelGeneratorTest.java | 31 +++++++++++++++- 4 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php index 5d677058b..f27147280 100644 --- a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php @@ -1,4 +1,5 @@ getData(self::SAMPLE_PROPERTY); + return $this->getData(self::SAMPLE_PROPERTY) === null ? null + : (string)$this->getData(self::SAMPLE_PROPERTY); } /** * @inheritDoc */ - public function setSampleProperty($sampleProperty) + public function setSampleProperty(?string $sampleProperty): void { - return $this->setData(self::SAMPLE_PROPERTY, $sampleProperty); + $this->setData(self::SAMPLE_PROPERTY, $sampleProperty); } } diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php new file mode 100644 index 000000000..404729c10 --- /dev/null +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php @@ -0,0 +1,37 @@ +getData(self::SAMPLE_PROPERTY) === null ? null + : (string)$this->getData(self::SAMPLE_PROPERTY); + } + + /** + * Setter for SampleProperty. + * + * @param string|null $sampleProperty + * + * @return void + */ + public function setSampleProperty(?string $sampleProperty): void + { + $this->setData(self::SAMPLE_PROPERTY, $sampleProperty); + } +} diff --git a/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php b/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php index 03ca695c1..6623ceec9 100644 --- a/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php +++ b/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php @@ -1,4 +1,5 @@ Date: Fri, 22 Jan 2021 13:06:58 +0200 Subject: [PATCH 4/7] Removed converting for string --- .../internal/Magento Data Model.php.ft | 3 ++- .../generateDataModel/Sample.php | 19 +++++++++++++- .../Sample.php | 26 ++++++++++++++++++- .../SampleInterface.php | 17 ++++++++++++ .../generator/DataModelGeneratorTest.java | 6 +++-- .../DataModelInterfaceGeneratorTest.java | 3 ++- 6 files changed, 68 insertions(+), 6 deletions(-) diff --git a/resources/fileTemplates/internal/Magento Data Model.php.ft b/resources/fileTemplates/internal/Magento Data Model.php.ft index 39ff676b7..7737829ef 100644 --- a/resources/fileTemplates/internal/Magento Data Model.php.ft +++ b/resources/fileTemplates/internal/Magento Data Model.php.ft @@ -55,8 +55,9 @@ class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS} && $has #end public function get$propertyUpperCamel(): ?$propertyType { + #set($propertyCast = "#if($propertyType != 'string')($propertyType)#{else}#end") return $this->getData(self::$propertyUpperSnake) === null ? null - : ($propertyType) $this->getData(self::$propertyUpperSnake); + : $propertyCast $this->getData(self::$propertyUpperSnake); } #if ($hasInterface) diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php index f27147280..d3c68591e 100644 --- a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php @@ -8,13 +8,30 @@ class Sample extends DataObject implements SampleInterface { + /** + * @inheritDoc + */ + public function getIdProperty(): ?int + { + return $this->getData(self::ID_PROPERTY) === null ? null + : (int)$this->getData(self::ID_PROPERTY); + } + + /** + * @inheritDoc + */ + public function setIdProperty(?int $idProperty): void + { + $this->setData(self::ID_PROPERTY, $idProperty); + } + /** * @inheritDoc */ public function getSampleProperty(): ?string { return $this->getData(self::SAMPLE_PROPERTY) === null ? null - : (string)$this->getData(self::SAMPLE_PROPERTY); + : $this->getData(self::SAMPLE_PROPERTY); } /** diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php index 404729c10..7f867963e 100644 --- a/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php @@ -10,8 +10,32 @@ class Sample extends DataObject /** * String constants for property names */ + const ID_PROPERTY = "id_property"; const SAMPLE_PROPERTY = "sample_property"; + /** + * Getter for IdProperty. + * + * @return int|null + */ + public function getIdProperty(): ?int + { + return $this->getData(self::ID_PROPERTY) === null ? null + : (int)$this->getData(self::ID_PROPERTY); + } + + /** + * Setter for IdProperty. + * + * @param int|null $idProperty + * + * @return void + */ + public function setIdProperty(?int $idProperty): void + { + $this->setData(self::ID_PROPERTY, $idProperty); + } + /** * Getter for SampleProperty. * @@ -20,7 +44,7 @@ class Sample extends DataObject public function getSampleProperty(): ?string { return $this->getData(self::SAMPLE_PROPERTY) === null ? null - : (string)$this->getData(self::SAMPLE_PROPERTY); + : $this->getData(self::SAMPLE_PROPERTY); } /** diff --git a/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php b/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php index 6623ceec9..389f31000 100644 --- a/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php +++ b/testData/actions/generation/generator/DataModelInterfaceGenerator/generateDataModelInterface/SampleInterface.php @@ -8,8 +8,25 @@ interface SampleInterface /** * String constants for property names */ + const ID_PROPERTY = "id_property"; const SAMPLE_PROPERTY = "sample_property"; + /** + * Getter for IdProperty. + * + * @return int|null + */ + public function getIdProperty(): ?int; + + /** + * Setter for IdProperty. + * + * @param int|null $idProperty + * + * @return void + */ + public function setIdProperty(?int $idProperty): void; + /** * Getter for SampleProperty. * diff --git a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java index 690583ced..9ebceb411 100644 --- a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java +++ b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java @@ -22,7 +22,8 @@ public void testGenerateDataModel() { "Foo_Bar", "Foo\\Bar\\Model\\Data\\Sample", "Foo\\Bar\\Api\\Data\\SampleInterface", - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", true ); final DataModelGenerator generator = new DataModelGenerator( @@ -50,7 +51,8 @@ public void testGenerateDataModelWithoutInterface() { "Foo_Bar", "Foo\\Bar\\Model\\Data\\Sample", "Foo\\Bar\\Api\\Data\\SampleInterface", - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", false ); final DataModelGenerator generator = new DataModelGenerator( diff --git a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java index fd4db23b1..799d432f9 100644 --- a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java +++ b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java @@ -21,7 +21,8 @@ public void testGenerateDataModelInterface() { "SampleInterface", "Foo_Bar", "Foo\\Bar\\Api\\Data\\SampleInterface", - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty" + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty" ); final DataModelInterfaceGenerator generator = new DataModelInterfaceGenerator( project, interfaceData From fdec600650a3e64c2a798667c28499785af04abd Mon Sep 17 00:00:00 2001 From: "andrii.zinkevych" Date: Fri, 22 Jan 2021 13:13:00 +0200 Subject: [PATCH 5/7] fixed pmd issue --- .../generation/generator/DataModelGeneratorTest.java | 8 ++++---- .../generator/DataModelInterfaceGeneratorTest.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java index 9ebceb411..aa6e9e248 100644 --- a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java +++ b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelGeneratorTest.java @@ -22,8 +22,8 @@ public void testGenerateDataModel() { "Foo_Bar", "Foo\\Bar\\Model\\Data\\Sample", "Foo\\Bar\\Api\\Data\\SampleInterface", - "ID_PROPERTY;id_property;int;IdProperty;idProperty," + - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", true ); final DataModelGenerator generator = new DataModelGenerator( @@ -51,8 +51,8 @@ public void testGenerateDataModelWithoutInterface() { "Foo_Bar", "Foo\\Bar\\Model\\Data\\Sample", "Foo\\Bar\\Api\\Data\\SampleInterface", - "ID_PROPERTY;id_property;int;IdProperty;idProperty," + - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty", false ); final DataModelGenerator generator = new DataModelGenerator( diff --git a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java index 799d432f9..9acbd1eb6 100644 --- a/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java +++ b/tests/com/magento/idea/magento2plugin/actions/generation/generator/DataModelInterfaceGeneratorTest.java @@ -21,8 +21,8 @@ public void testGenerateDataModelInterface() { "SampleInterface", "Foo_Bar", "Foo\\Bar\\Api\\Data\\SampleInterface", - "ID_PROPERTY;id_property;int;IdProperty;idProperty," + - "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty" + "ID_PROPERTY;id_property;int;IdProperty;idProperty," + + "SAMPLE_PROPERTY;sample_property;string;SampleProperty;sampleProperty" ); final DataModelInterfaceGenerator generator = new DataModelInterfaceGenerator( project, interfaceData From b03a9a12ff5ada4781652d89a61818a40945757e Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 22 Jan 2021 13:36:52 +0200 Subject: [PATCH 6/7] Update Sample.php --- .../generator/DataModelGenerator/generateDataModel/Sample.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php index d3c68591e..50cf49550 100644 --- a/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModel/Sample.php @@ -30,8 +30,7 @@ public function setIdProperty(?int $idProperty): void */ public function getSampleProperty(): ?string { - return $this->getData(self::SAMPLE_PROPERTY) === null ? null - : $this->getData(self::SAMPLE_PROPERTY); + return $this->getData(self::SAMPLE_PROPERTY); } /** From 6137f034f7a20d55ea1c02fece6a573a4267412d Mon Sep 17 00:00:00 2001 From: "andrii.zinkevych" Date: Fri, 22 Jan 2021 14:07:03 +0200 Subject: [PATCH 7/7] Fixed code --- resources/fileTemplates/internal/Magento Data Model.php.ft | 7 +++++-- .../generateDataModelWithoutInterface/Sample.php | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/fileTemplates/internal/Magento Data Model.php.ft b/resources/fileTemplates/internal/Magento Data Model.php.ft index 7737829ef..4857b7064 100644 --- a/resources/fileTemplates/internal/Magento Data Model.php.ft +++ b/resources/fileTemplates/internal/Magento Data Model.php.ft @@ -55,9 +55,12 @@ class ${NAME} #if (${EXTENDS})extends ${EXTENDS} #end #if (${IMPLEMENTS} && $has #end public function get$propertyUpperCamel(): ?$propertyType { - #set($propertyCast = "#if($propertyType != 'string')($propertyType)#{else}#end") + #if($propertyType == 'string') + return $this->getData(self::$propertyUpperSnake); + #{else} return $this->getData(self::$propertyUpperSnake) === null ? null - : $propertyCast $this->getData(self::$propertyUpperSnake); + : ($propertyType) $this->getData(self::$propertyUpperSnake); + #end } #if ($hasInterface) diff --git a/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php index 7f867963e..4ccfe431c 100644 --- a/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php +++ b/testData/actions/generation/generator/DataModelGenerator/generateDataModelWithoutInterface/Sample.php @@ -43,8 +43,7 @@ public function setIdProperty(?int $idProperty): void */ public function getSampleProperty(): ?string { - return $this->getData(self::SAMPLE_PROPERTY) === null ? null - : $this->getData(self::SAMPLE_PROPERTY); + return $this->getData(self::SAMPLE_PROPERTY); } /**