private function completeOwningSide(AssociationMetadata $property, $targetObject)
    {
        // add this object on the owning side as well, for obvious infinite recursion
        // reasons this is only done when called on the inverse side.
        if ($property->isOwningSide()) {
            return;
        }

        $mappedByField    = $property->getMappedBy();
        $targetMetadata   = self::$entityManager->getClassMetadata($property->getTargetEntity());
        $targetProperty   = $targetMetadata->getProperty($mappedByField);
        $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField;

        $targetObject->{$setterMethodName}($this);
    }