prooph / event-store-http-client

PHP 7.2 Event Store HTTP Client Implementation
BSD 3-Clause "New" or "Revised" License
25 stars 5 forks source link

Could not create DateTimeImmutable from string while getting stream events #55

Open bogdandubyk opened 3 years ago

bogdandubyk commented 3 years ago

When I'm trying to get events from stream, I'm getting the error Could not create DateTimeImmutable from string "2020-12-13T23:00:57.1574786Z". where 2020-12-13T23:00:57.1574786Z is the string representation of date in updated field

Here is a sample snippet code :

        $connection = EventStoreConnectionFactory::create(
            new ConnectionSettings(
                new EndPoint('localhost', 2113),
                'http',
            ),
            $this->httpClient,
            null
        );
        $connection->appendToStream(
             'newstream',
             ExpectedVersion::ANY,
             [
                 new EventData(
                     EventId::generate(),
                     'test-type',
                     true,
                     json_encode(['a' => '2']),
                     'meta'
                 )
             ]
         ));

        return $connection->readStreamEventsForward('newstream',0, 100));

and it's failing in Prooph\EventStoreHttpClient\Internal\ResolvedEventParser line 87, when creating RecordedEvent object.

I'm new to this package and to eventstore DB in general, so sorry if a question is stupid and issue is on my side, but I do not see how it can be on my side, as I do not rpovide any datetes while saving event, so I'm assuming issues is on package or eventstore configuration

enumag commented 3 years ago

Can you try with dev-master? There were some fixes around date formats.

bogdandubyk commented 3 years ago

yeah, it's working now, one more question, is ti package can be used in production? I'm looking for some ready to production solution, but it seems that no other solution for PHP?

enumag commented 3 years ago

@prolic ?

prolic commented 3 years ago

dev-master branch should be good to be used in production. I'm planning to release 1.0 final soon, but need to finish the documentation first and I am super busy right now.