src/UnitOfWork.php
private function findOldRelation(
        $relationValue,
        array $oldValue,
        ClassMetadata $classMetadata
    ) {
        $idSerializedKey = $classMetadata->getIdSerializeKey();

        $relationValueId = self::getEntityId($relationValue, $idSerializedKey);

        foreach ($oldValue as $oldRelationValue) {
            $oldRelationValueId = self::getEntityId(
                $oldRelationValue,
                $idSerializedKey
            );

            if ($relationValueId === $oldRelationValueId) {
                return $oldRelationValue;
            }
        }

        return $classMetadata->getDefaultSerializedModel();
    }
private function findOldRelation(
        $relationValue,
        array $oldValue,
        ClassMetadata $classMetadata
    ) {
        $idSerializedKey = $classMetadata->getIdSerializeKey();

        $relationValueId = self::getEntityId($relationValue, $idSerializedKey);

        foreach ($oldValue as $oldRelationValue) {
            $oldRelationValueId = self::getEntityId(
                $oldRelationValue,
                $idSerializedKey
            );

            if ($relationValueId === $oldRelationValueId) {
                return $oldRelationValue;
            }
        }

        return $classMetadata->getDefaultSerializedModel();
    }
@param string|array $relationValue

@return array|string