diff --git a/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml index fb541b9..7204f98 100644 --- a/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml +++ b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml @@ -14,7 +14,7 @@ - + diff --git a/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml index b2498a7..b229a88 100644 --- a/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml +++ b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/config/xml/Bitrix24.SDK.Core.Credentials.Scope.dcm.xml b/config/xml/Bitrix24.SDK.Core.Credentials.Scope.dcm.xml index 86ac70c..0df218b 100644 --- a/config/xml/Bitrix24.SDK.Core.Credentials.Scope.dcm.xml +++ b/config/xml/Bitrix24.SDK.Core.Credentials.Scope.dcm.xml @@ -2,6 +2,6 @@ xmlns:xs="https://www.w3.org/2001/XMLSchema" xmlns:orm="https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + \ No newline at end of file diff --git a/src/Bitrix24Accounts/Entity/Bitrix24Account.php b/src/Bitrix24Accounts/Entity/Bitrix24Account.php index faec717..1de7dc3 100644 --- a/src/Bitrix24Accounts/Entity/Bitrix24Account.php +++ b/src/Bitrix24Accounts/Entity/Bitrix24Account.php @@ -58,20 +58,21 @@ class Bitrix24Account implements Bitrix24AccountInterface, AggregateRootEventsEm */ private array $events = []; + public function __construct( #[ORM\Id] #[ORM\Column(type: UuidType::NAME, unique: true)] - private Uuid $uuid, + private Uuid $uuid, #[ORM\Column(name: 'b24_user_id', type: 'integer', nullable: false)] #[SerializedName('b24_user_id')] - private readonly int $bitrix24UserId, + private readonly int $bitrix24UserId, #[ORM\Column(name: 'is_b24_user_admin', type: 'boolean', nullable: false)] #[SerializedName('is_b24_user_admin')] - private readonly bool $isBitrix24UserAdmin, + private readonly bool $isBitrix24UserAdmin, /** bitrix24 portal unique id */ #[ORM\Column(name: 'member_id', type: 'string', nullable: false)] #[SerializedName('member_id')] - private readonly string $memberId, + private readonly string $memberId, #[ORM\Column(name: 'domain_url', type: 'string', nullable: false)] #[SerializedName('domain_url')] private string $domainUrl, diff --git a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php index e51a6a2..4598636 100644 --- a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php +++ b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php @@ -33,6 +33,8 @@ public function __construct( #[Override] public function getById(Uuid $uuid): Bitrix24AccountInterface { + // print_r($uuid); + // exit(); $res = $this->getEntityManager()->getRepository(Bitrix24Account::class)->find($uuid); if ($res === null) { throw new Bitrix24AccountNotFoundException(sprintf('bitrix24 account not found by id %s', $uuid->toRfc4122())); @@ -47,10 +49,12 @@ public function getById(Uuid $uuid): Bitrix24AccountInterface #[Override] public function save(Bitrix24AccountInterface $bitrix24Account): void { + $this->getEntityManager()->persist($bitrix24Account); //todo discuss add flush arg to contract or add flusher in usecases? - // $this->getEntityManager()->flush(); + $this->getEntityManager()->flush(); + } /** diff --git a/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php b/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php index 3ea83a4..e843460 100644 --- a/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php +++ b/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php @@ -45,7 +45,7 @@ class HandlerTest extends TestCase public function testRenewAuthTokenWithoutBitrix24UserId(): void { $bitrix24Account = new Bitrix24Account( - Uuid::v4(), + Uuid::v7(), 1, true, Uuid::v7()->toRfc4122(), @@ -57,6 +57,7 @@ public function testRenewAuthTokenWithoutBitrix24UserId(): void 1, new Scope() ); + $this->repository->save($bitrix24Account); $newAuthToken = new AuthToken('new_1', 'new_2', 3600);