Comments (3)
Hi @SerafimArts,
Noted. Thanks for your explanation and suggestion.
I will update my code to use DTO suggested by @wolfy-j instead of using associative array.
from sdk-php.
Hello!
It is worth noting that Temporal can communicate with external services that can be written in an arbitrary language. The default codec used is JSON, where there is no such thing as an associative array, as in most programming languages existing in the world.
Therefore, when packing such data into this format, the types are converted from an hash-map to an object:
['key' => 'value']
// ->
{"key": "value"}
Which is the representation of the anonymous object.
That is, in this case, this is not an bug, but rather a limitation of the transport protocol.
To solve this problem, you should convert the result explicitly back from anonymous object to PHP hash-map:
$assocArray = (array)(yield $simple->getAssocArray($input));
@wolfy-j perhaps can tell if switching to a different codec will help solve this problem. And if so, how to do it technically.
from sdk-php.
I would strongly recommend using proper DTO for such purposes. You can create objects with public properties. Temporal should typecast it if this object is set as the return type of the activity.
from sdk-php.
Related Issues (20)
- [Bug] Seeing a spike in CPU utilization in presence of the following error HOT 5
- [Bug] PHP 8.2: ${var} string interpolation deprecated
- [Feature Request] Allow to register checksum with the worker HOT 1
- [Bug] Activity not scheduled in signal handler HOT 23
- Support UUID in marshaller
- Improve PHP files generated from proto
- Worker versioning support
- PHP Workflow update support HOT 1
- [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
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.