adds a document to the body and transforms it in the right format.

@param array $idList
@author Daniel Wendlandt
436404
public function add(array $idList)
    {
        foreach ($idList as $id) {
            $action = array(
                self::BULK_ACTION => array(
                    '_id' => $id,
                    '_index' => $this->index,
                    '_type' => $this->type
                )
            );

            $this->body .= json_encode($action) . self::LINE_BREAK;
        }
    }
235962
protected function prepareListImageStyle(array &$list)
    {
        foreach ($list as $id => &$item) {
            $item['directory_exists'] = is_dir($this->image_style->getDirectory($id));
        }
    }
1370999
public void setUserIdList(java.util.Collection<String> userIdList) {
        if (userIdList == null) {
            this.userIdList = null;
            return;
        }

        this.userIdList = new java.util.ArrayList<String>(userIdList);
    }
881027
static public function removeNodes( array $removeNodeIdList )
    {
        $mainNodeChanged      = array();
        $nodeAssignmentIdList = array();
        $objectIdList         = array();

        $db = eZDB::instance();
        $db->begin();

        foreach ( $removeNodeIdList as $nodeId )
        {
            $node     = eZContentObjectTreeNode::fetch($nodeId);
            $objectId = $node->attribute( 'contentobject_id' );
            foreach ( eZNodeAssignment::fetchForObject( $objectId,
                                                        eZContentObject::fetch( $objectId )->attribute( 'current_version' ),
                                                        0, false ) as $nodeAssignmentKey => $nodeAssignment )
            {
                if ( $nodeAssignment['parent_node'] == $node->attribute( 'parent_node_id' ) )
                {
                    $nodeAssignmentIdList[$nodeAssignment['id']] = 1;
                }
            }

            if ( $nodeId == $node->attribute( 'main_node_id' ) )
                $mainNodeChanged[$objectId] = 1;
            $node->removeThis();

            if ( !isset( $objectIdList[$objectId] ) )
                $objectIdList[$objectId] = eZContentObject::fetch( $objectId );
        }

        eZNodeAssignment::purgeByID( array_keys( $nodeAssignmentIdList ) );

        foreach ( array_keys( $mainNodeChanged ) as $objectId )
        {
            $allNodes = $objectIdList[$objectId]->assignedNodes();
            // Registering node that will be promoted as 'main'
            if ( isset( $allNodes[0] ) )
            {
                $mainNodeChanged[$objectId] = $allNodes[0];
                eZContentObjectTreeNode::updateMainNodeID( $allNodes[0]->attribute( 'node_id' ), $objectId, false, $allNodes[0]->attribute( 'parent_node_id' ) );
            }
        }

        // Give other search engines that the default one a chance to reindex
        // when removing locations.
        if ( !eZSearch::getEngine() instanceof eZSearchEngine )
        {
            foreach ( array_keys( $objectIdList ) as $objectId )
                eZContentOperationCollection::registerSearchObject( $objectId );
        }

        $db->commit();

        //call appropriate method from search engine
        eZSearch::removeNodes( $removeNodeIdList );

        $userClassIdList = eZUser::contentClassIDs();
        foreach ( $objectIdList as $objectId => $object )
        {
            eZContentCacheManager::clearObjectViewCacheIfNeeded( $objectId );

            // clear user policy cache if this was a user object
            if ( in_array( $object->attribute( 'contentclass_id' ), $userClassIdList ) )
            {
                eZUser::purgeUserCacheByUserId( $object->attribute( 'id' ) );
            }

            // Give other search engines that the default one a chance to reindex
            // when removing locations.
            if ( !eZSearch::getEngine() instanceof eZSearchEngine )
            {
                eZContentOperationCollection::registerSearchObject( $objectId );
            }
        }

        // Triggering content/cache filter for Http cache purge
        ezpEvent::getInstance()->filter( 'content/cache', $removeNodeIdList, array_keys( $objectIdList ) );
        // we don't clear template block cache here since it's cleared in eZContentObjectTreeNode::removeNode()

        return array( 'status' => true );
    }
193214
public function setList($id, $listId)
    {
        return $this->put($this->getPath().'/'.rawurlencode($id).'/idList', array('value' => $listId));
    }
418113
public function batch(array $openIdList, int $id)
    {
        return self::$curl->post(self::BATCH_TAG.self::$access_token, json_encode([
                'openid_list' => $openIdList,
                'tagid' => $id,
            ]
        ));
    }
442942
public function extend(ListInterface $list)
    {
        $args = $list->toArray();
        array_unshift($args, null);
        $args[0] = &$this->data;

        call_user_func_array('array_push', $args);
    }
369700
public function getChildrenCategories($idList, int $counter = 0)
    {
        $cacheIdentifier = sha1('children' . $idList);

        $entry = $this->cache->get($cacheIdentifier);
        if (!$entry) {
            $entry = $this->getChildrenCategoriesRecursive($idList, $counter);
            $this->cache->set($cacheIdentifier, $entry);
        }

        return $entry;
    }
657089
public function addDocumentIds(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
    {
        if ($this->DocumentIds === null) {
            $this->DocumentIds = new \Protobuf\MessageCollection();
        }

        $this->DocumentIds->add($value);
    }
726203
public function updateRevisions(Model $Model, $idlist = array()) {
		if (!$Model->ShadowModel) {
			trigger_error('RevisionBehavior: ShadowModel doesnt exist.', E_USER_WARNING);
			return;
		}
		foreach ($idlist as $id) {
			$Model->id = $id;
			$Model->createRevision();
		}
	}
850248
def update_tags(self, idlist, tags_add=None, tags_remove=None):
        
        tags = {}
        if tags_add:
            tags["add"] = self._listify(tags_add)
        if tags_remove:
            tags["remove"] = self._listify(tags_remove)

        d = {
            "ids": self._listify(idlist),
            "tags": tags,
        }

        return self._proxy.Bug.update_tags(d)
834127
public function loadDescendantProductGroupIDListInto(&$idList)
    {
        if ($children = $this->AllChildren()) {
            foreach ($children as $child) {
                if (in_array($child->ID, $idList)) {
                    continue;
                }

                if ($child instanceof self) {
                    $idList[] = $child->ID;
                    $child->loadDescendantProductGroupIDListInto($idList);
                }
            }
        }
    }
609536
protected static function buildFileList($initialList) {
		
		$fileList = array();
		
		// see if it's an array. loop over the multiple items if it is
		if (is_array($initialList)) {
			foreach ($initialList as $listItem) {
				$fileList[$listItem] = $listItem;
			}
		} else {
			$fileList[$listItem] = $listItem;
		}
		
		return $fileList;
		
	}
247146
protected function sanitizeMixedDomNodeList(\DOMDocument $doc, &$list){

    $NewElement = $doc->createElement('text');

    $test = array(XML_ELEMENT_NODE=> FALSE, XML_TEXT_NODE=>FALSE);
    foreach($list as $node){
      $test[$node->nodeType] = TRUE;
    }

    //text only so exit
    if($test[XML_TEXT_NODE] == TRUE && $test[XML_ELEMENT_NODE] == FALSE){
      return;
    }

    //mixed group logic
    $newList = array();
    foreach($list as $k => $node){
      if (array_key_exists($node->nodeName, $this->inlineTags)||
        array_key_exists($node->nodeName, array('#text' => true))){
        unset($list[$k]);
        $NewElement->appendChild($node->cloneNode(true));
        if (!isset($node->nextSibling->nodeName)){
          $newList[$k] = $NewElement;
        }else if(array_key_exists($node->nextSibling->nodeName, $this->inlineTags)||
          array_key_exists($node->nextSibling->nodeName, array('#text' => true))){
          //do nothing
        }else{
          $newList[$k] = $NewElement;
        }
      }else{
        $newList[$k] = $node;
        $NewElement = $doc->createElement('text');
      }
    }
    $list = $newList;
  }
1120896
public function buildFilterRulesForUsedOnly($filter, $idList = [])
    {
        $result = $this
            ->getConnection()
            ->createQueryBuilder()
            ->select('value_id AS id')
            ->from('tl_metamodel_tag_relation')
            ->where('att_id=:attId')
            ->groupBy('value_id')
            ->setParameter('attId', $this->get('id'));

        if (!empty($idList)) {
            $result
                ->andWhere('item_id IN (:itemIds)')
                ->setParameter('itemIds', $idList, Connection::PARAM_STR_ARRAY);
        }

        $filter->addFilterRule(SimpleQuery::createFromQueryBuilder($result));
    }
711050
public function addCustomerRelations(int $idProductList, array $customerIds): void
    {
        foreach ($customerIds as $idCustomer) {
            $productListCustomerEntity = new SpyProductListCustomer();
            $productListCustomerEntity->setFkProductList($idProductList)
                ->setFkCustomer($idCustomer)
                ->save();
        }
    }
288646
private static function appendAdditionalNodeIDs( eZContentObject $contentObject, &$nodeIDList )
    {
        $contentObjectId = $contentObject->attribute( 'id' );
        if ( !isset( self::$additionalNodeIDsPerObject[$contentObjectId] ) )
            return;

        foreach ( self::$additionalNodeIDsPerObject[$contentObjectId] as $nodeID )
        {
            $nodeIDList[] = $nodeID;
        }
    }