-
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
Showing
18 changed files
with
269 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\User; | ||
|
||
class PasswordUser | ||
{ | ||
public function __construct( | ||
private string $uuid, | ||
private string $password, | ||
private User $user, | ||
) { | ||
} | ||
|
||
public function getUuid(): string | ||
{ | ||
return $this->uuid; | ||
} | ||
|
||
public function getPassword(): string | ||
{ | ||
return $this->password; | ||
} | ||
|
||
public function setPassword(string $password): self | ||
{ | ||
$this->password = $password; | ||
|
||
return $this; | ||
} | ||
|
||
public function getUser(): User | ||
{ | ||
return $this->user; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\User; | ||
|
||
class ProConnectUser | ||
{ | ||
public function __construct( | ||
private string $uuid, | ||
private User $user, | ||
) { | ||
} | ||
|
||
public function getUuid(): string | ||
{ | ||
return $this->uuid; | ||
} | ||
|
||
public function getUser(): User | ||
{ | ||
return $this->user; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Domain/User/Repository/PasswordUserRepositoryInterface.php
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Domain\User\Repository; | ||
|
||
use App\Domain\User\PasswordUser; | ||
|
||
interface PasswordUserRepositoryInterface | ||
{ | ||
public function add(PasswordUser $passwordUser): PasswordUser; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
src/Infrastructure/Persistence/Doctrine/Mapping/User.PasswordUser.orm.xml
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
<entity name="App\Domain\User\PasswordUser" table="password_user"> | ||
<id name="uuid" type="guid" column="uuid"/> | ||
<field name="password" type="string" column="password" nullable="false"/> | ||
<one-to-one field="user" target-entity="App\Domain\User\User" inversed-by="passwordUser"> | ||
<join-column name="user_uuid" referenced-column-name="uuid" nullable="false" on-delete="CASCADE"/> | ||
</one-to-one> | ||
</entity> | ||
</doctrine-mapping> |
9 changes: 9 additions & 0 deletions
9
src/Infrastructure/Persistence/Doctrine/Mapping/User.ProConnectUser.orm.xml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
<entity name="App\Domain\User\ProConnectUser" table="proconnect_user"> | ||
<id name="uuid" type="guid" column="uuid"/> | ||
<one-to-one field="user" target-entity="App\Domain\User\User" inversed-by="proConnectUser"> | ||
<join-column name="user_uuid" referenced-column-name="uuid" nullable="false" on-delete="CASCADE"/> | ||
</one-to-one> | ||
</entity> | ||
</doctrine-mapping> |
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
45 changes: 45 additions & 0 deletions
45
src/Infrastructure/Persistence/Doctrine/Migrations/Version20250113103218.php
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Infrastructure\Persistence\Doctrine\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20250113103218 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE TABLE password_user (uuid UUID NOT NULL, user_uuid UUID NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(uuid))'); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_1FC6D102ABFE1C6F ON password_user (user_uuid)'); | ||
$this->addSql('CREATE TABLE proconnect_user (uuid UUID NOT NULL, user_uuid UUID NOT NULL, PRIMARY KEY(uuid))'); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_9010F504ABFE1C6F ON proconnect_user (user_uuid)'); | ||
$this->addSql('ALTER TABLE password_user ADD CONSTRAINT FK_1FC6D102ABFE1C6F FOREIGN KEY (user_uuid) REFERENCES "user" (uuid) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
$this->addSql('ALTER TABLE proconnect_user ADD CONSTRAINT FK_9010F504ABFE1C6F FOREIGN KEY (user_uuid) REFERENCES "user" (uuid) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
$this->addSql(' | ||
INSERT INTO password_user (uuid, user_uuid, password) | ||
SELECT uuid_generate_v4() AS uuid, u.uuid as user_uuid, u.password as password FROM public.user AS u | ||
'); | ||
$this->addSql('ALTER TABLE "user" DROP password'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('ALTER TABLE password_user DROP CONSTRAINT FK_1FC6D102ABFE1C6F'); | ||
$this->addSql('ALTER TABLE proconnect_user DROP CONSTRAINT FK_9010F504ABFE1C6F'); | ||
$this->addSql('DROP TABLE password_user'); | ||
$this->addSql('DROP TABLE proconnect_user'); | ||
$this->addSql('ALTER TABLE "user" ADD password VARCHAR(255) NOT NULL'); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Infrastructure/Persistence/Doctrine/Repository/User/PasswordUserRepository.php
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Infrastructure\Persistence\Doctrine\Repository\User; | ||
|
||
use App\Domain\User\PasswordUser; | ||
use App\Domain\User\Repository\PasswordUserRepositoryInterface; | ||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | ||
use Doctrine\Persistence\ManagerRegistry; | ||
|
||
final class PasswordUserRepository extends ServiceEntityRepository implements PasswordUserRepositoryInterface | ||
{ | ||
public function __construct( | ||
ManagerRegistry $registry, | ||
) { | ||
parent::__construct($registry, PasswordUser::class); | ||
} | ||
|
||
public function add(PasswordUser $passwordUser): PasswordUser | ||
{ | ||
$this->getEntityManager()->persist($passwordUser); | ||
|
||
return $passwordUser; | ||
} | ||
} |
Oops, something went wrong.