private function processRelationQueue(Bag $relationQueue)
    {
        foreach ($relationQueue as $source => $links) {
            $entity = $this->query->getContent($source);
            $relations = [];
            foreach ($links as $linkKey) {
                $relation = $this->query->getContent($linkKey);
                $relatedKey = (string) $relation->getContentType();

                $relations[$relatedKey][] = $relation->getId();
            }
            /** @var Collection\Relations $related */
            $related = $this->em->createCollection(Entity\Relations::class);
            $related->setFromPost(['relation' => $relations], $entity);
            $entity->setRelation($related);
            $this->em->save($entity);
        }
    }
private function processRelationQueue(Bag $relationQueue)
    {
        foreach ($relationQueue as $source => $links) {
            $entity = $this->query->getContent($source);
            $relations = [];
            foreach ($links as $linkKey) {
                $relation = $this->query->getContent($linkKey);
                $relatedKey = (string) $relation->getContentType();

                $relations[$relatedKey][] = $relation->getId();
            }
            /** @var Collection\Relations $related */
            $related = $this->em->createCollection(Entity\Relations::class);
            $related->setFromPost(['relation' => $relations], $entity);
            $entity->setRelation($related);
            $this->em->save($entity);
        }
    }
private function processRelationQueue ( Bag $ relationQueue ) { foreach ( $ relationQueue as $ source => $ links ) { $ entity = $ this -> query -> getContent ( $ source ) ; $ relations = [ ] ; foreach ( $ links as $ linkKey ) { $ relation = $ this -> query -> getContent ( $ linkKey ) ; $ relatedKey = ( string ) $ relation -> getContentType ( ) ; $ relations [ $ relatedKey ] [ ] = $ relation -> getId ( ) ; } /** @var Collection\Relations $related */ $ related = $ this -> em -> createCollection ( Entity \ Relations :: class ) ; $ related -> setFromPost ( [ 'relation' => $ relations ] , $ entity ) ; $ entity -> setRelation ( $ related ) ; $ this -> em -> save ( $ entity ) ; } }
Since relations can't be processed until we are sure all the individual
records are saved this goes through the queue after an import and links
up all the related ones.

@param Bag $relationQueue
Since relations can t be processed until we are sure all the individual records are saved this goes through the queue after an import and links up all the related ones .