getUnitChangeSet doesn't work correct with json

Viewed 16

My method:

public function getUpdatedColumns(Shop $shop): array
    {
        $uow = $this->entityManager->getUnitOfWork();
        $uow->computeChangeSets();

        return $uow->getEntityChangeSet($shop);
    }

What I get is this:

array(1) {
["mailConfig"]=>
array(2) {
[0]=>
string(25) "{"transport": "sendgrid"}"
[1]=>
string(24) "{"transport":"sendgrid"}"
}
}

and because of this whitespace, getEntityChangeSet returns result when the field is not actually updated. Is there a workaround when we are working with JSON ? The database field is JSON as well if that matters.

0 Answers
Related