Skip to content

Aggregate root not found in MariaDb #297

Description

@Danielss89

I'm using MariaDb and when i use my collection to find an Aggregate root by id, it returns nothing.
When looking in the database i have this:

# no, event_id, event_name, payload, metadata, created_at, aggregate_version, aggregate_id, aggregate_type
1, d61ad36c-f92a-47e7-a7b9-07dab87d4e03, Application\Event\User\UserWasCreated, {"user_id":"8d373db9-ff5c-4ac7-aa64-087f819c80ed","email":"danielss89@gmail.com","password":"1234","firstname":"Daniel","lastname":"Str\u00f8m","created":"O:13:\"Carbon\\Carbon\":3:{s:4:\"date\";s:26:\"2017-09-18 09:25:28.459152\";s:13:\"timezone_type\";i:3;s:8:\"timezone\";s:17:\"Europe\/Copenhagen\";}"}, {"_aggregate_id":"8d373db9-ff5c-4ac7-aa64-087f819c80ed","_aggregate_version":1,"_aggregate_type":"Application\\Model\\User\\User"}, 2017-09-18 07:25:28.471408, 1, 8d373db9-ff5c-4ac7-aa64-087f819c80ed, Application\Model\User\User

And i select like this: $this->userCollection->get('ace19986-67f1-436d-82ef-787bc882adf3');

If i dump the metadata values which are used in the where clause i get:

/var/www/application/vendor/prooph/pdo-event-store/src/MariaDbEventStore.php:315:
string(27) "Application\Model\User\User"
/var/www/application/vendor/prooph/pdo-event-store/src/MariaDbEventStore.php:315:
string(36) "ace19986-67f1-436d-82ef-787bc882adf3"

So as you see, the value in the database has escaped backslashes(because json_encode was used) and the value it tries to select with only has single slashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions