Skip to content

Commit

Permalink
accept an entity id
Browse files Browse the repository at this point in the history
  • Loading branch information
withinboredom committed Jan 14, 2024
1 parent 272a93e commit 3ea0f2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/OrchestrationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public static function reset(){
};
}

public function entityOp(string $id, \Closure $operation): mixed
public function entityOp(string|EntityId $id, \Closure $operation): mixed
{
$func = new \ReflectionFunction($operation);
if($func->getNumberOfParameters() !== 1) {
Expand Down Expand Up @@ -498,7 +498,7 @@ public function entityOp(string $id, \Closure $operation): mixed
throw new LogicException('Did not call an operation');
}

$entityId = new EntityId($name, $id);
$entityId = $id instanceof EntityId ? $id : new EntityId($name, $id);

if($returns) {
return $this->waitOne($this->callEntity($entityId, $operationName, $arguments));
Expand Down
4 changes: 2 additions & 2 deletions src/OrchestrationContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public function signalEntity(EntityId $entityId, string $operation, array $args
/**
* @template T
* @template V
* @param string $id
* @param string|EntityId $id
* @param \Closure(T): V $operation
* @return V
*/
public function entityOp(string $id, \Closure $operation): mixed;
public function entityOp(string|EntityId $id, \Closure $operation): mixed;

/**
* Determines if an entity is locked. Returns true if the entity is locked.
Expand Down

0 comments on commit 3ea0f2b

Please sign in to comment.