Get changes from a Doctrine entity

Code
<?php

use PHPSnippets\Db\Entity\Test;

/* @var $em Doctrine\ORM\EntityManager */
$uow $em->getUnitOfWork();

$entityChanges = function ($entity) use ($em$uow) {
    
// compute changes into changeset
    
$uow->computeChangeSet(
        
$em->getClassMetadata(Test::CLASS),
        
$entity
    
);

    echo 
'Is entity scheduled for update, delete, etc.?';
    
dump($uow->isEntityScheduled($entity));
    echo 
'What changed in entity (value before/after)?';
    
dump($uow->getEntityChangeSet($entity));
};

// get Test entity with id 1
$entity $em->find(Test::CLASS, 1);
dump($entity);

echo 
'<b>Set same value for entity name</b>' PHP_EOL;
$entity->name 'foo';
$entityChanges($entity);

echo 
'<b>Change value of name</b>' PHP_EOL;
$entity->name 'foobar';
$entityChanges($entity);

echo 
'<b>Change name again and date value</b>' PHP_EOL;
$entity->name 'foobar2';
$entity->creationDate = new DateTime();
$entityChanges($entity);
Result
^ PHPSnippets\Db\Entity\Test {#1417
+id: 1
+name: "foo"
+creationDate: DateTime @1405849049 {#1415
date: 2014-07-20 11:37:29.0 Europe/Berlin (+02:00)
}
+subTests: Doctrine\ORM\PersistentCollection {#1424
-snapshot: []
-owner: PHPSnippets\Db\Entity\Test {#1417}
-association: array:15 [ …15]
-em: Doctrine\ORM\EntityManager {#1322 …11}
-backRefFieldName: "test"
-typeClass: Doctrine\ORM\Mapping\ClassMetadata {#1420 …}
-isDirty: false
#collection: Doctrine\Common\Collections\ArrayCollection {#1428
-elements: []
}
#initialized: false
}
}

Set same value for entity name
Is entity scheduled for update, delete, etc.?
^ false

What changed in entity (value before/after)?
^ []

Change value of name
Is entity scheduled for update, delete, etc.?
^ true

What changed in entity (value before/after)?
^ array:1 [
"name" => array:2 [
0 => "foo"
1 => "foobar"
]
]

Change name again and date value
Is entity scheduled for update, delete, etc.?
^ true

What changed in entity (value before/after)?
^ array:2 [
"name" => array:2 [
0 => "foobar"
1 => "foobar2"
]
"creationDate" => array:2 [
0 => DateTime @1405849049 {#1415
date: 2014-07-20 11:37:29.0 Europe/Berlin (+02:00)
}
1 => DateTime @1635275457 {#1433
date: 2021-10-26 21:10:57.453024 Europe/Berlin (+02:00)
}
]
]
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8