Repository: DamienHarper/auditor (php)

Issue:
Json colums are double encoded


| Q                    | A
| ---------------------| -----------------------
| `auditor` version    | 2.0.5
| PHP version          | 8.1.0
| Database             | MySQL / PostgreSQL / SQLite / Other

#### Summary

Json diffs are encoded twice. At the end it doesn't show correctly in viewer
![image](https://user-images.githubusercontent.com/661654/198999008-59ebd907-78a7-453d-b23f-23c01e6abe01.png)


#### Current behavior

Message in viewer encoded twice 
```
"\u041f\u0420\u0418\u041c\u0415\u0420"
```

#### How to reproduce

- Create entity with JSON column
- Fill something in entity, that can be encoded with UTF-8, for example, `ПРИМЕР`
- Save entity

#### Expected behavior
I see `ПРИМЕР` in viewer



Pull request description:
Fix JSON column UTF-8 twice encoded
Closes #119 

Patch:
diff --git a/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php b/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
index 24d7f7e..1d3dfb5 100644
--- a/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
+++ b/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
@@ -120,6 +120,9 @@ trait AuditTrait
 
                 break;
 
+            case DoctrineHelper::getDoctrineType('JSON'):
+                return $value;
+
             default:
                 $convertedValue = $type->convertToDatabaseValue($value, $platform);
         }


Test patch:
diff --git a/tests/Provider/Doctrine/Issues/Issue119Test.php b/tests/Provider/Doctrine/Issues/Issue119Test.php
new file mode 100644
index 0000000..ab0d592
--- /dev/null
+++ b/tests/Provider/Doctrine/Issues/Issue119Test.php
@@ -0,0 +1,53 @@
+<?php
+
+declare(strict_types=1);
+
+namespace DH\Auditor\Tests\Provider\Doctrine\Issues;
+
+use DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionProcessor;
+use DH\Auditor\Provider\Doctrine\Model\Transaction;
+use DH\Auditor\Provider\Doctrine\Persistence\Reader\Reader;
+use DH\Auditor\Tests\Provider\Doctrine\Fixtures\Entity\Standard\DummyEntity;
+use DH\Auditor\Tests\Provider\Doctrine\Traits\Schema\DefaultSchemaSetupTrait;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @internal
+ *
+ * @small
+ */
+final class Issue119Test extends TestCase
+{
+    use DefaultSchemaSetupTrait;
+
+    public function testIssue119(): void
+    {
+        $reader = new Reader($this->provider);
+        $processor = new TransactionProcessor($this->provider);
+        $entityManager = $this->createEntityManager();
+        $transaction = new Transaction($entityManager);
+        $entity = new DummyEntity();
+        $transaction->insert($entity, [
+            'json_array' => [null, [
+                'example' => '例',
+            ]],
+        ]);
+        $processor->process($transaction);
+        $audits = $reader->createQuery(DummyEntity::class)->execute();
+        self::assertCount(1, $audits, 'results count ok.');
+
+        /** @var \DH\Auditor\Model\Entry $audit */
+        $audit = $audits[0];
+        $diffs = $audit->getDiffs()['json_array'];
+        self::assertSame([
+            'example' => '例',
+        ], $diffs['new']);
+    }
+
+    private function configureEntities(): void
+    {
+        $this->provider->getConfiguration()->setEntities([
+            DummyEntity::class => ['enabled' => true],
+        ]);
+    }
+}