DataBuilderGenerator creates invalid code


When does the bug occur:

When calling console transfer:databuilder:generate the Generated\Shared\DataBuilder\ReclamationBuilder will contain the methods withOrder() and withAnotherOrder twice, as the order dependency is added twice but with different casing (order and Order).
The issue does occur with the recent demoshop (tested commit:

Why does this is an issue:
As soon as the code needs to be compiled or executed, for example to cache it via opcode cache, it will fail the compilation process. This could lead to an empty opcode cache and therefore decrease the performance in a production system or worse trigger an opcode cache regeneration for the given file every time it is executed with the same falling result.

Possible solution:
I could solve it with the following patch (using a normalized case version for dependencies to avoid duplicated dependencies).

Index: vendor/spryker/transfer/src/Spryker/Zed/Transfer/Business/Model/Generator/DataBuilderDefinition.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
--- vendor/spryker/transfer/src/Spryker/Zed/Transfer/Business/Model/Generator/DataBuilderDefinition.php	(date 1548398538000)
+++ vendor/spryker/transfer/src/Spryker/Zed/Transfer/Business/Model/Generator/DataBuilderDefinition.php	(date 1548398538000)
@@ -68,9 +68,10 @@
                 if (isset($property['singular']) && !isset($this->dependencies[$property['singular']])) {
                     $property['name'] = $property['singular'];
-                $property['ucfirstName'] = ucfirst($property['name']);
+                $uppercaseName = ucfirst($property['name']);
+                $property['ucfirstName'] = $uppercaseName;
                 $property['type'] = str_replace('[]', '', $property['type']); // remove array marker
-                $this->dependencies[$property['name']] = $property;
+                $this->dependencies[$uppercaseName] = $property;


Hi Alberto,

Thank you for the feedback. The ticket is created. I will notify when it is fixed.

Best regards,