Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
陆云峰 committed Oct 14, 2022
1 parent 45b2e10 commit 737e8bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Attributes/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace BiiiiiigMonster\Clearable\Attributes;

use Attribute;
use BiiiiiigMonster\Clearable\ClearManager;

#[Attribute(Attribute::TARGET_METHOD)]
class Clear
Expand All @@ -17,7 +18,7 @@ class Clear
public function __construct(
public ?string $invokableClearClassName = null,
public ?string $clearQueue = null,
public ?string $clearConnection = null,
public ?string $clearConnection = ClearManager::SYNC_QUEUE_CONNECTION,
) {
}
}
2 changes: 2 additions & 0 deletions src/ClearManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

class ClearManager
{
public const SYNC_QUEUE_CONNECTION = 'sync';

/**
* ClearManager constructor.
*
Expand Down
8 changes: 5 additions & 3 deletions src/Concerns/HasClears.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* Trait HasClears
*
* @property array $clears The relationships that will be auto-cleared when deleted.
* @property ?string $clearQueue The clearable that will be dispatch on this name queue.
* @property ?string $clearConnection The clearable that will be dispatch on this name queue.
* @property ?string $clearQueue The clearable that will be dispatch on this named queue.
* @property ?string $clearConnection The clearable that will be dispatch on this connection queue.
*/
trait HasClears
{
Expand Down Expand Up @@ -91,7 +91,9 @@ public function setClearQueue(?string $clearQueue): static
*/
public function getClearConnection(): ?string
{
return $this->clearConnection;
return property_exists(static::class, 'clearConnection')
? $this->clearConnection
: ClearManager::SYNC_QUEUE_CONNECTION;
}

/**
Expand Down

0 comments on commit 737e8bb

Please sign in to comment.