public function registerReflectionIdAccessors($classNames, $idPropertyName)
    {
        foreach ((array)$classNames as $className) {
            $getter = function ($entity) use ($className, $idPropertyName) {
                $reflectionClass = new ReflectionClass($className);
                $property        = $reflectionClass->getProperty($idPropertyName);
                $property->setAccessible(true);

                return $property->getValue($entity);
            };
            $setter = function ($entity, $id) use ($className, $idPropertyName) {
                $reflectionClass = new ReflectionClass($className);
                $property        = $reflectionClass->getProperty($idPropertyName);
                $property->setAccessible(true);
                $property->setValue($entity, $id);
            };
            $this->registerIdAccessors($classNames, $getter, $setter);
        }
    }