/**
  * {@inheritdoc}
  */
 protected function createSubordinateIterator($staticSegment)
 {
     $vars = $this->provider->provideExtendedMergeVars($staticSegment->getMarketingList());
     $varNames = array_map(function ($each) {
         return $each['name'];
     }, $vars);
     $qb = $this->doctrineHelper->getEntityManager($this->extendedMergeVarClassName)->getRepository($this->extendedMergeVarClassName)->createQueryBuilder('extendedMergeVar');
     $qb->select(['extendedMergeVar.id', $staticSegment->getId() . ' static_segment_id', 'extendedMergeVar.name', $qb->expr()->literal(ExtendedMergeVar::STATE_REMOVE) . ' state']);
     $qb->where($qb->expr()->andX($qb->expr()->eq('extendedMergeVar.staticSegment', ':staticSegment'), $qb->expr()->notIn('extendedMergeVar.name', ':vars'), $qb->expr()->neq('extendedMergeVar.state', ':state')))->setParameter('staticSegment', $staticSegment)->setParameter('vars', $varNames)->setParameter('state', ExtendedMergeVar::STATE_DROPPED);
     $bufferedIterator = new BufferedQueryResultIterator($qb);
     $bufferedIterator->setHydrationMode(AbstractQuery::HYDRATE_ARRAY)->setReverse(true);
     return $bufferedIterator;
 }
 /**
  * {@inheritdoc}
  */
 protected function createSubordinateIterator($staticSegment)
 {
     $vars = $this->provider->provideExtendedMergeVars($staticSegment->getMarketingList());
     $existingVars = $staticSegment->getExtendedMergeVars([ExtendedMergeVar::STATE_ADD, ExtendedMergeVar::STATE_SYNCED])->map(function (ExtendedMergeVar $extendedMergeVar) {
         return $extendedMergeVar->getName();
     })->toArray();
     $vars = array_filter($vars, function ($var) use($existingVars) {
         return !in_array($var['name'], $existingVars, true);
     });
     return new \CallbackFilterIterator(new \ArrayIterator($vars), function (&$current) use($staticSegment) {
         if (is_array($current)) {
             $current['static_segment_id'] = $staticSegment->getId();
             $current['state'] = ExtendedMergeVar::STATE_ADD;
         }
         return true;
     });
 }