-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #556: expose Workflow Init Method
- Loading branch information
Showing
17 changed files
with
294 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Temporal\Internal\Declaration; | ||
|
||
use Temporal\DataConverter\ValuesInterface; | ||
use Temporal\Internal\Declaration\Dispatcher\AutowiredPayloads; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class MethodHandler | ||
{ | ||
private readonly AutowiredPayloads $dispatcher; | ||
|
||
public function __construct( | ||
private readonly object $instance, | ||
\ReflectionFunctionAbstract $reflection, | ||
) { | ||
$this->dispatcher = new AutowiredPayloads($reflection); | ||
} | ||
|
||
/** | ||
* Resolve arguments for the method. | ||
*/ | ||
public function resolveArguments(ValuesInterface $values): array | ||
{ | ||
return $this->dispatcher->resolveArguments($values); | ||
} | ||
|
||
public function __invoke(ValuesInterface $values): mixed | ||
{ | ||
$arguments = $this->resolveArguments($values); | ||
return $this->dispatcher->dispatch($this->instance, $arguments); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of Temporal package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Temporal\Workflow; | ||
|
||
use Doctrine\Common\Annotations\Annotation\Target; | ||
|
||
/** | ||
* Marks a Workflow constructor to be executed with the {@see WorkflowMethod} arguments. | ||
* The Init Method is executed before the Workflow Method, Signal, and Update handlers. | ||
* | ||
* @Annotation | ||
* @Target({ "METHOD" }) | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_METHOD)] | ||
final class InitMethod {} |
Oops, something went wrong.