Skip to content

Commit 92b24f3

Browse files
committed
Fix Entity Creation Using Stubs
1 parent f6cb17e commit 92b24f3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Commands/MakeEntity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,19 @@ public function handle(): int
105105
$accessorsStub = file_get_contents($entityStubsPath.'accessors.stub');
106106

107107
// Initialize Class
108-
$baseContent = str_replace(['EntityNameSpace', 'EntityName'], [$entityNamespace, $entityName], $baseContent);
108+
$baseContent = str_replace(['{{ EntityNamespace }}', '{{ EntityName }}'], [$entityNamespace, $entityName], $baseContent);
109109

110110
// Create Attributes
111111
foreach ($columns as $_column) {
112112
$baseContent = substr_replace($baseContent,
113-
$this->writeAttribute($attributeStub, $this->dataTypes[$_column->DATA_TYPE], $_column->COLUMN_NAME),
113+
$this->writeAttribute($attributeStub, $_column->COLUMN_NAME, $this->dataTypes[$_column->DATA_TYPE]),
114114
-1, 0);
115115
}
116116
// Create Additional Attributes from Foreign Keys
117117
if ($detectForeignKeys) {
118118
foreach ($foreignKeys as $_foreignKey) {
119119
$baseContent = substr_replace($baseContent,
120-
$this->writeAttribute($attributeStub, $_foreignKey->ENTITY_DATA_TYPE, $_foreignKey->VARIABLE_NAME),
120+
$this->writeAttribute($attributeStub, $_foreignKey->VARIABLE_NAME, $_foreignKey->ENTITY_DATA_TYPE),
121121
-1, 0);
122122
}
123123
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
protected {{ AttributeType }} ${{ AttributeName }};
1+
protected {{ AttributeType }} ${{ AttributeName }};

0 commit comments

Comments
 (0)