Comments (2)
@benkelukas I have investigated the problem. Try to do the following:
- In your
WorkflowInterface
add explicit attribute for the return type:
interface GreetingWorkflowInterface
{
/**
* @param string $name
* @return WorkflowResult
*/
#[WorkflowMethod(name: "SimpleActivity.greet")]
#[ReturnType(WorkflowResult::class)]
public function greet(string $name);
}
- In the command don't forget that the result object is now
WorkflowResult
. Don't try to print it, and use on of the getters:
$output->writeln(sprintf("Result:\n<info>%s</info>", $run->getResult()->getGreeting()));
Hope, it will help you. Waiting for you feedback.
from sdk-php.
Hi @seregazhuk
thanks a lot for taking a look at this, it works! :)
I suppose I could've tried this by myself, however, there is the ExpectedType
attribute on the ReturnType
attribute's type argument, so I kinda supposed (wrongly) that this is not possible.
Maybe it would be also good to update docs to mention that one can, in fact, use PHP protobuf messages and what to do when one wants to use it for Workflow return types, as I think it's a pretty good way how to structure data passing between activities / worfklows - but I understand that not everybody wants to go through the hassle of generating PHP code from .proto
files - not sure if it is in scope for the docs.
There remains one little caveat for me: PHPStorm complains that I've provided unexpected type to the ReturnType
annotation, it's nothing serious and I can disable inspections for statement, but maybe the attribute could be expanded to allow custom types somehow?
Thanks again for taking the time to help me, You guys rock! :)
I'm closing the issue, cheers!
from sdk-php.
Related Issues (20)
- [Feature Request] Add friendly version of listWorkflowExecutions
- [Bug] DataConverter type named "null" is not a valid type name HOT 4
- [Feature Request] Separate client to another package HOT 1
- Add an ability to set timeout for all client calls HOT 1
- [Feature Request] `EnableEagerStart` option in the PHP `StartWorkflowOptions` structure HOT 1
- Add ability to pass UUID objects in arguments directly (not nested)
- SideEffects: cast returned value based on callable return type
- [Feature Request] Define Workflow return type via attribute HOT 1
- [Maintenance] Update reactphp/promise to v3
- Add UUID sugar like Workflow::uuid() HOT 1
- [Bug] Issue with Doctrine Annotation Reader and Need to Disable SelectiveReader`
- [Interceptors] Remove DataConverter from header value object
- react/promise v3 doesn't work fine
- [Feature Request][PHP] Start delay
- [Bug] worker returns "Workflow with the specified run identifier.." HOT 3
- Update google/common-protos to v4
- Add PHP 8.3 in the CI
- [Bug] Schedule API: Given value is not an instance of Google\Protobuf\Timestamp
- [Bug] Methods without ActivityMethod attribute are registered as Activities
- [Bug] Schedule API: Schedule creating without start and end time not working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk-php.