Skip to content

Commit 9f25848

Browse files
refactor(Command): add makeMySqlRepoCreator method to MakeMySqlRepository
1 parent 7616294 commit 9f25848

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Commands/MakeMySqlRepository.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ private function getColumnsOf(string $tableName): Collection
7676

7777
private function generateBaseContent(string $filenameWithPath): string
7878
{
79-
$mysqlRepoCreator = new CreatorMySqlRepository(
79+
$mysqlRepoCreator = $this->makeMySqlRepoCreator();
80+
81+
return (new BaseCreator($mysqlRepoCreator))->createClass($filenameWithPath, $this);
82+
}
83+
84+
/**
85+
* @return CreatorMySqlRepository
86+
*/
87+
private function makeMySqlRepoCreator(): CreatorMySqlRepository
88+
{
89+
return new CreatorMySqlRepository(
8090
$this->getColumnsOf($this->tableName),
8191
$this->tableName,
8292
$this->entityName,
@@ -90,7 +100,5 @@ private function generateBaseContent(string $filenameWithPath): string
90100
$this->mysqlRepositoryStubsPath,
91101
$this->detectForeignKeys
92102
);
93-
94-
return (new BaseCreator($mysqlRepoCreator))->createClass($filenameWithPath, $this);
95103
}
96104
}

0 commit comments

Comments
 (0)