Add categories data to the index data.

{@inheritdoc}
439182
public function addData($storeId, array $indexData)
    {
        $categoryData = $this->resourceModel->loadCategoryData($storeId, array_keys($indexData));

        foreach ($categoryData as $categoryDataRow) {
            $productId = (int) $categoryDataRow['product_id'];
            unset($categoryDataRow['product_id']);

            $categoryDataRow = array_merge(
                $categoryDataRow,
                [
                    'category_id' => (int) $categoryDataRow['category_id'],
                    'is_parent'   => (bool) $categoryDataRow['is_parent'],
                    'name'        => (string) $categoryDataRow['name'],
                ]
            );

            if (isset($categoryDataRow['position']) && $categoryDataRow['position'] !== null) {
                $categoryDataRow['position'] = (int) $categoryDataRow['position'];
            }

            if (isset($categoryDataRow['is_blacklisted'])) {
                $categoryDataRow['is_blacklisted'] = (bool) $categoryDataRow['is_blacklisted'];
            }

            $indexData[$productId]['category'][] = array_filter($categoryDataRow);
        }

        return $indexData;
    }
176182
public function addCategory(CategoryInterface $category)
    {
        if (!$this
            ->categories
            ->contains($category)
        ) {
            $this
                ->categories
                ->add($category);
        }

        return $this;
    }
1004442
protected function addCategoryGroup()
    {
        if (!$this->isError()) {
            $id = $this->category_group->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
650599
public function addSubCategory(CategoryInterface $category)
    {
        if (!$this
            ->subCategories
            ->contains($category)
        ) {
            $this
                ->subCategories
                ->add($category);
        }

        return $this;
    }
1048285
private function AddCategoryField()       
    {
        $name = 'Category';
        $value = '';
        if ($this->article->Exists()) {
            $value = $this->article->GetCategory()->GetID();
        }
        $field = new Select($name, $value);
        $field->AddOption('', Trans('Core.PleaseSelect'));
        $catList = new CategoryListProvider($this->archive);
        $categories = $catList->ToArray();
        foreach ($categories as $category) {
            $field->AddOption($category->GetID(), $category->GetName());
        }
        $this->AddField($field);
        $this->SetRequired($name);
    }
737712
public function addData($key, $value)
    {
        if (isset($this->data[$key])) {
            $this->data[$key] = array_merge_recursive(
                $this->data[$key],
                $value
            );
        } else {
            $this->setData($key, $value);
        }
    }
386101
protected function setFilterIndexCategory()
    {
        $default = array(
            'view' => $this->configTheme('catalog_view', 'grid'),
            'sort' => $this->configTheme('catalog_sort', 'price'),
            'order' => $this->configTheme('catalog_order', 'asc')
        );

        $this->setFilter(array(), $this->getFilterQuery($default));
    }
180361
public function addCategory(\Amulen\ClassificationBundle\Entity\Category $category)
    {
        $this->categories[] = $category;

        return $this;
    }
690982
protected function initCategories()
    {
        $collection = $this->getCollection();

        /** @var CategoryModel $category */
        foreach ($collection as $category) {
            $structure = explode('/', $category->getData(CategoryModel::KEY_PATH));
            $pathSize = count($structure);

            if ($pathSize > 1) {
                $path = [];
                for ($i = 1; $i < $pathSize; $i++) {
                    /** @var CategoryModel $c */
                    $c = $collection->getItemById($structure[$i]);
                    $path[] = $c->getData(CategoryModel::KEY_NAME);
                }

                $rootCategoryName = array_shift($path);
                if (!isset($this->categoriesWithRoots[$rootCategoryName])) {
                    $this->categoriesWithRoots[$rootCategoryName] = [];
                }

                $index = $this->implodeEscaped($this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR), $path);
                $this->categoriesWithRoots[$rootCategoryName][$index] = [
                    'entity_id' => $category->getId(),
                    CategoryModel::KEY_PATH => $category->getData(CategoryModel::KEY_PATH),
                    CategoryModel::KEY_LEVEL => $category->getData(CategoryModel::KEY_LEVEL),
                    CategoryModel::KEY_POSITION => $category->getData(CategoryModel::KEY_POSITION)
                ];

                //allow importing by ids.
                if (!isset($this->categoriesWithRoots[$structure[1]])) {
                    $this->categoriesWithRoots[$structure[1]] = [];
                }

                $this->categoriesWithRoots[$structure[1]][$category->getId()] =
                    $this->categoriesWithRoots[$rootCategoryName][$index];
            }
        }

        return $this;

    }
1191292
@Override
    public void add(final int index, final SyndCategory obj) {
        final SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
        DCSubject subject;
        if (sCat != null) {
            subject = sCat.getSubject();
        } else {
            subject = null;
        }
        subjects.add(index, subject);
    }
836712
def category(self, categories):
        
        if isinstance(categories, list):
            for c in categories:
                self.add_category(c)
        else:
            self.add_category(categories)
915306
protected function setCategoryField()
    {
        $sCategoryID = array_get($this->arImportData, 'category_id');
        if ($sCategoryID === null) {
            return;
        }

        //Find category by external ID
        $obCategory = Category::getByExternalID($sCategoryID)->first();
        if (empty($obCategory)) {
            $this->arImportData['category_id'] = null;
        } else {
            $this->arImportData['category_id'] = $obCategory->id;
        }
    }
841272
public function add($obs)
    {
        foreach ($this->_normalize($obs) as $val) {
            $this->_data[] = $val;
        }
    }
444742
public function addItems($data)
	{
		if( is_null($data) )
		{
			return;
		}

		if( $data instanceof stdClass )
		{
			$data = [$data];
		}

		if( is_array($data) )
		{
			$data = $this->checkItems($data);
			$this->data = array_merge($this->data, $data);
		}
	}
1136489
public function addCategory(SpyCategory $categoryEntity, SpyCategoryNode $categoryNodeEntity)
    {
        $this->categoryKeys[$categoryEntity->getCategoryKey()] = [
            static::ID_CATEGORY => $categoryEntity->getIdCategory(),
            static::ID_CATEGORY_NODE => $categoryNodeEntity->getIdCategoryNode(),
        ];

        $urls = [];
        $categoryNodeEntityCollection = $categoryEntity->getNodes();
        foreach ($categoryNodeEntityCollection as $categoryNode) {
            foreach ($categoryNode->getSpyUrls() as $urlEntity) {
                $urls[] = [
                    static::ID_LOCALE => $urlEntity->getFkLocale(),
                    static::URL => $urlEntity->getUrl(),
                ];
            }
        }

        $this->categoryUrls[$categoryEntity->getCategoryKey()] = $urls;
    }
658853
public function addParentCategory(CategoryInterface $category): CategoryInterface
    {
        if (!$this->hasParentCategory($category)) {
            $this->parentCategories->add($category);
        }

        return $this;
    }
1164488
protected function prepareListCategory(array &$categories)
    {
        foreach ($categories as &$category) {
            $this->setItemIndentation($category, '— ');
            $this->setItemUrlEntity($category, $this->store, 'category');
        }
    }