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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* (improvement) Require Symfony 8.1+
* (feature) Use [Symfonys native message deduplication](https://symfony.com/doc/current/messenger.html#message-deduplication)
* (improvement) Use UUIDv7 instead of ULID for task ids
* (deprecation) Deprecate `TaskLog::$ulid`, use `TaskLog::$uuid` instead.
* (deprecation) Deprecate `TaskLog::$ulid`.
* (feature) Add `Task::prepareForTaskLog()` to be able to modify the payload before storing it in the database.


Expand Down
2 changes: 1 addition & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
==========

* `TaskLog::getTaskObject()` was removed. Use `TaskDetailsNormalizer::deserializeTask($log)` instead.
* `TaskLog::$ulid` was removed, use `TaskLog::$uuid` instead.
* `TaskLog::$ulid` was removed.


1.x to 2.0
Expand Down
3 changes: 2 additions & 1 deletion src/Entity/TaskLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public function __construct (
)
{
$this->taskClass = $task::class;
$this->taskId = $task->uuid;
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
$this->taskId = $task->ulid;
$this->runs = new ArrayCollection();
$this->timeQueued = now();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Model/TaskLogModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function findByTaskId (string $taskId) : ?TaskLog
*/
public function getLogForTask (Task $task) : TaskLog
{
$log = $this->findByTaskId($task->uuid);
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
$log = $this->findByTaskId($task->ulid);

if (null !== $log)
{
Expand Down
8 changes: 3 additions & 5 deletions src/Task/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
*/
abstract readonly class Task
{
public string $uuid;

/**
* @deprecated use $taskId instead
*
* @todo remove in 4.0
*
* @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4)
*/
public string $ulid;

Expand All @@ -23,8 +23,7 @@
public function __construct ()
{
$uuid = new UuidV7()->toString();
$this->uuid = $uuid;
/** @phpstan-ignore-next-line property.deprecated (We still need to support the deprecated property) */
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
$this->ulid = $uuid;
}

Expand All @@ -44,7 +43,6 @@ public function withNewTaskUlid () : static
$uuid = new UuidV7()->toString();

return clone($this, [
"uuid" => $uuid,
"ulid" => $uuid,
]);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Entity/TaskLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ public function testTaskIdMatchesTaskUlid () : void
$task = $this->createTask();
$log = new TaskLog($task);

self::assertSame($task->uuid, $log->taskId);
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
self::assertSame($task->ulid, $log->taskId);
}

public function testTaskClassMatchesTaskClass () : void
Expand Down
6 changes: 4 additions & 2 deletions tests/Task/TaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public function getMetaData () : TaskMetaData
}
};

$initialUlid = $task->uuid;
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
$initialUlid = $task->ulid;
$newTask = $task->withNewTaskUlid();
self::assertNotSame($initialUlid, $newTask->uuid, "Task ULID should change on PHP 8.4");
/** @phpstan-ignore-next-line property.deprecated (The uuid integration will be refactored in v4) */
self::assertNotSame($initialUlid, $newTask->ulid, "Task ULID should change on PHP 8.4");
}
}
Loading