Skip to content

Commit dda87ae

Browse files
authored
Fix annotations reader dependency in workflow client (#100)
1 parent f447c5f commit dda87ae

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Client/WorkflowClient.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111

1212
namespace Temporal\Client;
1313

14+
use Doctrine\Common\Annotations\Reader;
15+
use Spiral\Attributes\AnnotationReader;
1416
use Spiral\Attributes\AttributeReader;
17+
use Spiral\Attributes\Composite\Composite;
18+
use Spiral\Attributes\Composite\SelectiveReader;
19+
use Spiral\Attributes\ReaderInterface;
1520
use Temporal\Client\GRPC\ServiceClientInterface;
1621
use Temporal\DataConverter\DataConverter;
1722
use Temporal\DataConverter\DataConverterInterface;
@@ -54,7 +59,19 @@ public function __construct(
5459
$this->clientOptions = $options ?? new ClientOptions();
5560
$this->converter = $converter ?? DataConverter::createDefault();
5661
$this->starter = new WorkflowStarter($serviceClient, $this->converter, $this->clientOptions);
57-
$this->reader = new WorkflowReader(new AttributeReader());
62+
$this->reader = new WorkflowReader($this->createReader());
63+
}
64+
65+
/**
66+
* @return ReaderInterface
67+
*/
68+
private function createReader(): ReaderInterface
69+
{
70+
if (\interface_exists(Reader::class)) {
71+
return new SelectiveReader([new AnnotationReader(), new AttributeReader()]);
72+
}
73+
74+
return new AttributeReader();
5875
}
5976

6077
/**

0 commit comments

Comments
 (0)