Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<field name="domainUrl" type="string" column="domain_url" nullable="false"/>

<field name="accountStatus" type="string" column="account_status" nullable="false"/>
<field name="accountStatus" enum-type="string" column="account_status" nullable="false"/>

<embedded name="authToken" class="Bitrix24\SDK\Core\Credentials\AuthToken"/>

Expand Down
2 changes: 1 addition & 1 deletion config/xml/Bitrix24.SDK.Core.Credentials.AuthToken.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<field name="accessToken" type="string" column="access_token"/>
<field name="refreshToken" type="string" column="refresh_token"/>
<field name="expires" type="integer" column="expires"/>
<field name="expiresIn" type="integer" column="expires_in"/>
<field name="expiresIn" type="integer" nullable="true" column="expires_in"/>
</embeddable>
</doctrine-mapping>
2 changes: 1 addition & 1 deletion config/xml/Bitrix24.SDK.Core.Credentials.Scope.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
xmlns:xs="https://www.w3.org/2001/XMLSchema"
xmlns:orm="https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Bitrix24\SDK\Core\Credentials\Scope">
<field name="currentScope" type="json" column="current_scope"/>
<field name="currentScope" type="json" nullable="true" column="current_scope"/>
</embeddable>
</doctrine-mapping>
9 changes: 5 additions & 4 deletions src/Bitrix24Accounts/Entity/Bitrix24Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,28 @@

private ?string $comment = null;

private AuthToken $authToken;

Check failure on line 54 in src/Bitrix24Accounts/Entity/Bitrix24Account.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, highest, ubuntu-latest)

Property Bitrix24\Lib\Bitrix24Accounts\Entity\Bitrix24Account::$authToken is never read, only written.

/**
* @var Event[]
*/
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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();

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class HandlerTest extends TestCase
public function testRenewAuthTokenWithoutBitrix24UserId(): void
{
$bitrix24Account = new Bitrix24Account(
Uuid::v4(),
Uuid::v7(),
1,
true,
Uuid::v7()->toRfc4122(),
Expand All @@ -57,6 +57,7 @@ public function testRenewAuthTokenWithoutBitrix24UserId(): void
1,
new Scope()
);

$this->repository->save($bitrix24Account);

$newAuthToken = new AuthToken('new_1', 'new_2', 3600);
Expand Down
Loading