generated from dunglas/symfony-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d629bd
commit 6802389
Showing
12 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,6 @@ APP_SECRET=this_is_secret | |
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" | ||
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
DEFAULT_USERNAME=admin | ||
DEFAULT_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
use App\Entity\User; | ||
use App\Repository\UserRepository; | ||
use Symfony\Component\DependencyInjection\Attribute\Autowire; | ||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||
use Symfony\Component\PasswordHasher\PasswordHasherInterface; | ||
use Zenstruck\Foundry\ModelFactory; | ||
|
@@ -36,8 +37,11 @@ final class UserFactory extends ModelFactory | |
* | ||
* @todo inject services if required | ||
*/ | ||
public function __construct(private UserPasswordHasherInterface $passwordHasher) | ||
{ | ||
public function __construct( | ||
private UserPasswordHasherInterface $passwordHasher, | ||
#[Autowire('%env(DEFAULT_USERNAME)%')] private readonly string $defaultUsername, | ||
#[Autowire('%env(DEFAULT_PASSWORD)%')] private readonly string $defaultPassword, | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
|
@@ -49,8 +53,8 @@ public function __construct(private UserPasswordHasherInterface $passwordHasher) | |
protected function getDefaults(): array | ||
{ | ||
return [ | ||
'email' => '[email protected]', | ||
'password' => '1234', | ||
'email' => $this->defaultUsername, | ||
'password' => $this->defaultPassword, | ||
'roles' => [], | ||
]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters