From 6a7b8a94e80318b10bdf02d575b0857538311f18 Mon Sep 17 00:00:00 2001 From: KarlsonComplete Date: Mon, 21 Oct 2024 23:40:27 +0300 Subject: [PATCH 1/4] =?UTF-8?q?-=20=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B8?= =?UTF-8?q?=D0=B7=20namespace=20sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/doctrine | 3 +-- composer.json | 4 ++-- config/{doctrine => }/xml/Bitrix24Account.dcm.xml | 2 +- config/{doctrine => }/xml/TestUser.dcm.xml | 2 +- src/Bitrix24Accounts/Entity/Bitrix24Account.php | 4 ++-- src/Bitrix24Accounts/Entity/TestUser.php | 2 +- .../MultipleBitrix24AccountsFoundException.php | 2 +- .../Doctrine/Bitrix24AccountRepository.php | 6 +++--- src/Bitrix24Accounts/ReadModel/Fetcher.php | 2 +- .../UseCase/ChangeDomainUrl/Command.php | 2 +- .../UseCase/ChangeDomainUrl/Handler.php | 2 +- src/Bitrix24Accounts/UseCase/Command/Flusher.php | 2 +- .../UseCase/InstallFinish/Command.php | 2 +- .../UseCase/InstallFinish/Handler.php | 4 ++-- .../UseCase/InstallStart/Command.php | 2 +- .../UseCase/InstallStart/Handler.php | 4 ++-- .../UseCase/RenewAuthToken/Command.php | 2 +- .../UseCase/RenewAuthToken/Handler.php | 4 ++-- src/Bitrix24Accounts/UseCase/Uninstall/Command.php | 2 +- src/Bitrix24Accounts/UseCase/Uninstall/Handler.php | 6 +++--- tests/EntityManagerFactory.php | 5 +++-- .../Doctrine/Bitrix24AccountRepositoryTest.php | 10 +++++----- .../UseCase/RenewAuthToken/HandlerTest.php | 14 +++++++------- .../Entity/Bitrix24AccountTest.php | 4 ++-- 24 files changed, 46 insertions(+), 46 deletions(-) rename config/{doctrine => }/xml/Bitrix24Account.dcm.xml (95%) rename config/{doctrine => }/xml/TestUser.dcm.xml (87%) diff --git a/bin/doctrine b/bin/doctrine index 9f213bc..cf20dbe 100644 --- a/bin/doctrine +++ b/bin/doctrine @@ -1,12 +1,11 @@ #!/usr/bin/env php - + diff --git a/config/doctrine/xml/TestUser.dcm.xml b/config/xml/TestUser.dcm.xml similarity index 87% rename from config/doctrine/xml/TestUser.dcm.xml rename to config/xml/TestUser.dcm.xml index 6e330dc..5bc14bf 100644 --- a/config/doctrine/xml/TestUser.dcm.xml +++ b/config/xml/TestUser.dcm.xml @@ -2,7 +2,7 @@ xmlns:xsi="https://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"> - + diff --git a/src/Bitrix24Accounts/Entity/Bitrix24Account.php b/src/Bitrix24Accounts/Entity/Bitrix24Account.php index 31b9d24..3a3b15c 100644 --- a/src/Bitrix24Accounts/Entity/Bitrix24Account.php +++ b/src/Bitrix24Accounts/Entity/Bitrix24Account.php @@ -10,7 +10,7 @@ declare(strict_types=1); -namespace Bitrix24\SDK\Lib\Bitrix24Accounts\Entity; +namespace Bitrix24\Lib\Bitrix24Accounts\Entity; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus; @@ -25,7 +25,7 @@ use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException; use Bitrix24\SDK\Core\Response\DTO\RenewedAuthToken; -use Bitrix24\SDK\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; +use Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; use Carbon\CarbonImmutable; use Override; use Symfony\Bridge\Doctrine\Types\UuidType; diff --git a/src/Bitrix24Accounts/Entity/TestUser.php b/src/Bitrix24Accounts/Entity/TestUser.php index 51a1543..4627681 100644 --- a/src/Bitrix24Accounts/Entity/TestUser.php +++ b/src/Bitrix24Accounts/Entity/TestUser.php @@ -1,7 +1,7 @@ Date: Tue, 22 Oct 2024 01:03:48 +0300 Subject: [PATCH 2/4] =?UTF-8?q?-=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BB=20xml=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=BC=D0=B0=D0=BF=D0=BF?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3=D0=B0=20-=20=D0=9F=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=8F=D0=BB=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=85=D0=B5=D0=BC=20=D0=B2=20xml=20?= =?UTF-8?q?-=20=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=20=D0=BC=D0=B5=D0=BD=D1=8F?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=B2=20xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml} | 12 ++++++------ ...x24.Lib.Bitrix24Accounts.Entity.TestUser.dcm.xml} | 7 +++---- src/Bitrix24Accounts/Entity/TestUser.php | 1 + .../Doctrine/Bitrix24AccountRepository.php | 4 +--- 4 files changed, 11 insertions(+), 13 deletions(-) rename config/xml/{Bitrix24Account.dcm.xml => Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml} (74%) rename config/xml/{TestUser.dcm.xml => Bitrix24.Lib.Bitrix24Accounts.Entity.TestUser.dcm.xml} (55%) diff --git a/config/xml/Bitrix24Account.dcm.xml b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml similarity index 74% rename from config/xml/Bitrix24Account.dcm.xml rename to config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml index 93e83ff..c113aa4 100644 --- a/config/xml/Bitrix24Account.dcm.xml +++ b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml @@ -1,10 +1,10 @@ - + xmlns:xs="https://www.w3.org/2001/XMLSchema" + xmlns:orm="https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> + - + + @@ -14,7 +14,7 @@ - + diff --git a/config/xml/TestUser.dcm.xml b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.TestUser.dcm.xml similarity index 55% rename from config/xml/TestUser.dcm.xml rename to config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.TestUser.dcm.xml index 5bc14bf..2d30540 100644 --- a/config/xml/TestUser.dcm.xml +++ b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.TestUser.dcm.xml @@ -1,9 +1,8 @@ + xmlns:xs="https://www.w3.org/2001/XMLSchema" + xmlns:orm="https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + diff --git a/src/Bitrix24Accounts/Entity/TestUser.php b/src/Bitrix24Accounts/Entity/TestUser.php index 4627681..216d1f2 100644 --- a/src/Bitrix24Accounts/Entity/TestUser.php +++ b/src/Bitrix24Accounts/Entity/TestUser.php @@ -30,6 +30,7 @@ public function setPassword(string $password): void { $this->password = $password; } + public function getId(): int { return $this->id; diff --git a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php index ecd1f0f..413787d 100644 --- a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php +++ b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php @@ -19,14 +19,12 @@ class Bitrix24AccountRepository extends EntityRepository implements Bitrix24AccountRepositoryInterface { - private Flusher $flusher; public function __construct( EntityManagerInterface $entityManager, - Flusher $flusher + private readonly Flusher $flusher ) { parent::__construct($entityManager, $entityManager->getClassMetadata(Bitrix24Account::class)); - $this->flusher = $flusher; } /** From ba737ec8a0c1525cea58714d1d6b023d34f16166 Mon Sep 17 00:00:00 2001 From: KarlsonComplete Date: Fri, 25 Oct 2024 00:52:55 +0300 Subject: [PATCH 3/4] =?UTF-8?q?-=20=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=20Flusher=20-=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20useCase=20=D0=BD=D0=B0=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20-=20=D0=94=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20xml=20=D1=81=20authtoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...x24Accounts.Entity.Bitrix24Account.dcm.xml | 4 +- ...x24.SDK.Core.Credentials.AuthToken.dcm.xml | 14 +++++++ .../Doctrine/Bitrix24AccountRepository.php | 9 ++-- .../UseCase/SaveAccount/Command.php | 14 +++++++ .../UseCase/SaveAccount/Handler.php | 24 +++++++++++ .../UseCase/Command => Services}/Flusher.php | 2 +- .../Bitrix24AccountRepositoryTest.php | 11 +++-- .../UseCase/RenewAuthToken/HandlerTest.php | 21 ++++------ .../UseCase/SaveAccount/HandlerTest.php | 41 +++++++++++++++++++ 9 files changed, 113 insertions(+), 27 deletions(-) create mode 100644 config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml create mode 100644 src/Bitrix24Accounts/UseCase/SaveAccount/Command.php create mode 100644 src/Bitrix24Accounts/UseCase/SaveAccount/Handler.php rename src/{Bitrix24Accounts/UseCase/Command => Services}/Flusher.php (81%) create mode 100644 tests/Functional/Bitrix24Accounts/UseCase/SaveAccount/HandlerTest.php diff --git a/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml index c113aa4..16d4273 100644 --- a/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml +++ b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml @@ -4,7 +4,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml new file mode 100644 index 0000000..9b557fd --- /dev/null +++ b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php index 413787d..b512f42 100644 --- a/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php +++ b/src/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepository.php @@ -4,14 +4,14 @@ namespace Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine; +use Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account; +use Bitrix24\Lib\Bitrix24Accounts\UseCase\SaveAccount\Handler; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Exceptions\Bitrix24AccountNotFoundException; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterface; use Bitrix24\SDK\Application\Contracts\Events\AggregateRootEventsEmitterInterface; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; -use Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account; -use Bitrix24\Lib\Bitrix24Accounts\UseCase\Command\Flusher; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use Override; @@ -20,8 +20,7 @@ class Bitrix24AccountRepository extends EntityRepository implements Bitrix24AccountRepositoryInterface { public function __construct( - EntityManagerInterface $entityManager, - private readonly Flusher $flusher + EntityManagerInterface $entityManager ) { parent::__construct($entityManager, $entityManager->getClassMetadata(Bitrix24Account::class)); @@ -49,9 +48,9 @@ public function getById(Uuid $uuid): Bitrix24AccountInterface 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->flusher->flush(); } /** diff --git a/src/Bitrix24Accounts/UseCase/SaveAccount/Command.php b/src/Bitrix24Accounts/UseCase/SaveAccount/Command.php new file mode 100644 index 0000000..04742a6 --- /dev/null +++ b/src/Bitrix24Accounts/UseCase/SaveAccount/Command.php @@ -0,0 +1,14 @@ +bitrix24AccountRepository->save($command->bitrix24AccountRepository); + + $this->flusher->flush(); + } +} \ No newline at end of file diff --git a/src/Bitrix24Accounts/UseCase/Command/Flusher.php b/src/Services/Flusher.php similarity index 81% rename from src/Bitrix24Accounts/UseCase/Command/Flusher.php rename to src/Services/Flusher.php index f1f52ed..292e7d4 100644 --- a/src/Bitrix24Accounts/UseCase/Command/Flusher.php +++ b/src/Services/Flusher.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Bitrix24\Lib\Bitrix24Accounts\UseCase\Command; +namespace Bitrix24\Lib\Services; use Doctrine\ORM\EntityManagerInterface; diff --git a/tests/Functional/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepositoryTest.php b/tests/Functional/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepositoryTest.php index ce3e0c7..24fbfd4 100644 --- a/tests/Functional/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepositoryTest.php +++ b/tests/Functional/Bitrix24Accounts/Infrastructure/Doctrine/Bitrix24AccountRepositoryTest.php @@ -13,15 +13,15 @@ namespace Bitrix24\Lib\Tests\Functional\Bitrix24Accounts\Infrastructure\Doctrine; +use Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account; +use Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; +use Bitrix24\Lib\Services\Flusher; +use Bitrix24\Lib\Tests\EntityManagerFactory; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus; use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterface; -use Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account; use Bitrix24\SDK\Core\Credentials\AuthToken; use Bitrix24\SDK\Core\Credentials\Scope; -use Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; -use Bitrix24\Lib\Bitrix24Accounts\UseCase\Command\Flusher; -use Bitrix24\Lib\Tests\EntityManagerFactory; use Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterfaceTest; use Carbon\CarbonImmutable; use Override; @@ -65,7 +65,6 @@ protected function createBitrix24AccountImplementation( protected function createBitrix24AccountRepositoryImplementation(): Bitrix24AccountRepositoryInterface { $entityManager = EntityManagerFactory::get(); - $flusher = new Flusher($entityManager); - return new Bitrix24AccountRepository($entityManager,$flusher); + return new Bitrix24AccountRepository($entityManager); } } \ No newline at end of file diff --git a/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php b/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php index 0c8214c..3ea83a4 100644 --- a/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php +++ b/tests/Functional/Bitrix24Accounts/UseCase/RenewAuthToken/HandlerTest.php @@ -13,23 +13,19 @@ namespace Bitrix24\Lib\Tests\Functional\Bitrix24Accounts\UseCase\RenewAuthToken; -use Bitrix24\SDK\Application\ApplicationStatus; -use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus; -use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterface; -use Bitrix24\SDK\Core\Exceptions\WrongConfigurationException; -use Bitrix24\SDK\Core\Response\DTO\RenewedAuthToken; use Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account; -use Bitrix24\SDK\Core\Credentials\AuthToken; -use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; -use Bitrix24\Lib\Bitrix24Accounts\UseCase\Command\Flusher; use Bitrix24\Lib\Bitrix24Accounts\UseCase\RenewAuthToken\Command; use Bitrix24\Lib\Bitrix24Accounts\UseCase\RenewAuthToken\Handler; +use Bitrix24\Lib\Services\Flusher; use Bitrix24\Lib\Tests\EntityManagerFactory; +use Bitrix24\SDK\Application\ApplicationStatus; +use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus; +use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterface; +use Bitrix24\SDK\Core\Credentials\AuthToken; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Response\DTO\RenewedAuthToken; use Carbon\CarbonImmutable; -use Doctrine\DBAL\Exception; -use Doctrine\ORM\Exception\ORMException; -use Doctrine\ORM\OptimisticLockException; use Override; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; @@ -87,8 +83,7 @@ public function testRenewAuthTokenWithoutBitrix24UserId(): void protected function setUp(): void { $entityManager = EntityManagerFactory::get(); - $flusher = new Flusher($entityManager); - $this->repository = new Bitrix24AccountRepository($entityManager,$flusher); + $this->repository = new Bitrix24AccountRepository($entityManager); $this->handler = new Handler( new EventDispatcher(), $this->repository, diff --git a/tests/Functional/Bitrix24Accounts/UseCase/SaveAccount/HandlerTest.php b/tests/Functional/Bitrix24Accounts/UseCase/SaveAccount/HandlerTest.php new file mode 100644 index 0000000..9bc80fe --- /dev/null +++ b/tests/Functional/Bitrix24Accounts/UseCase/SaveAccount/HandlerTest.php @@ -0,0 +1,41 @@ + Date: Sat, 26 Oct 2024 10:31:47 +0300 Subject: [PATCH 4/4] =?UTF-8?q?-=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BC=D0=B0=D0=BF=D0=BF=D0=B8=D0=BD=D0=B3=20AuthToken?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20Bitrix24Account?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...trix24Accounts.Entity.Bitrix24Account.dcm.xml | 16 ++-------------- ...trix24.SDK.Core.Credentials.AuthToken.dcm.xml | 16 ++++++---------- src/Bitrix24Accounts/Entity/Bitrix24Account.php | 6 +++++- tests/EntityManagerFactory.php | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml b/config/xml/Bitrix24.Lib.Bitrix24Accounts.Entity.Bitrix24Account.dcm.xml index 16d4273..671cb2d 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 @@ - + @@ -25,18 +25,6 @@ - - - - - - - - - - - - - + \ No newline at end of file diff --git a/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml index 9b557fd..b2498a7 100644 --- a/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml +++ b/config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml @@ -1,14 +1,10 @@ - - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/src/Bitrix24Accounts/Entity/Bitrix24Account.php b/src/Bitrix24Accounts/Entity/Bitrix24Account.php index 3a3b15c..b0f066e 100644 --- a/src/Bitrix24Accounts/Entity/Bitrix24Account.php +++ b/src/Bitrix24Accounts/Entity/Bitrix24Account.php @@ -27,6 +27,7 @@ use Bitrix24\SDK\Core\Response\DTO\RenewedAuthToken; use Bitrix24\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository; use Carbon\CarbonImmutable; +use Doctrine\ORM\Mapping\Embedded; use Override; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Serializer\Annotation\Ignore; @@ -50,6 +51,8 @@ class Bitrix24Account implements Bitrix24AccountInterface, AggregateRootEventsEm private ?string $comment = null; + private AuthToken $authToken; + /** * @var Event[] */ @@ -74,7 +77,7 @@ public function __construct( private string $domainUrl, #[ORM\Column(name: 'account_status', type: 'string', nullable: false, enumType: Bitrix24AccountStatus::class)] private Bitrix24AccountStatus $accountStatus, - AuthToken $authToken, + AuthToken $authToken, #[ORM\Column(name: 'created_at_utc', type: 'carbon_immutable', precision: 3, nullable: false)] #[Ignore] private readonly CarbonImmutable $createdAt, @@ -87,6 +90,7 @@ public function __construct( Scope $applicationScope, ) { + $this->authToken = $authToken; $this->accessToken = $authToken->accessToken; $this->refreshToken = $authToken->refreshToken; $this->expires = $authToken->expires; diff --git a/tests/EntityManagerFactory.php b/tests/EntityManagerFactory.php index ca198ec..2475265 100644 --- a/tests/EntityManagerFactory.php +++ b/tests/EntityManagerFactory.php @@ -28,7 +28,7 @@ class EntityManagerFactory */ public static function get(): EntityManagerInterface { - /*$paths = [ + /* $paths = [ dirname(__DIR__) . '/src/Bitrix24Accounts/Entity' ];*/ $paths = [