### Environment #### Sonata packages show ``` Direct dependencies required in composer.json: sonata-project/entity-audit-bundle 1.12.0 1.12.0 Audit for Doctrine Entities ``` #### Symfony packages show ``` $ composer show --latest 'symfony/*' # Put the result here. ``` #### PHP version ``` php -v PHP 7.4.33 (cli) (built: Apr 11 2024 22:13:28) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies with Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans ``` ## Subject Auditing entity which uses foreign key as primary key throws exception when entity manager flushes. ## Minimal repository with the bug ## Steps to reproduce When entity manager flushes and exception is thrown: spl_object_id() expects parameter 1 to be object, string given  Table product:   Table product_company  ## Expected results ## Actual results