@param int $id

@return CategoryInterface
@throws \LogicException
541577
public function find(int $id): CategoryInterface
    {
        $response = $this->shopware()->get('/api/categories/'.(string)$id);

        $categoryWrapper = $this->deserializer()
                                ->deserialize((string)$response->getBody());

        $category = $categoryWrapper->getData();
        if ( ! $category instanceof CategoryInterface) {
            throw new \LogicException();
        }

        return $category;
    }
161527
public function setId($id)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($id) {
            if ($tab instanceof FormInterface) {
                $tab->setId($id);
            }
        });

        return $this;
    }
183328
protected function replaceRoot(&$id)
    {
        if (null !== $id && $id === self::ROOT_PLACEHOLDER) {
            $rootId = $this->getRootId($this->import);
            if ($rootId === null) {
                throw new LogicException('Import root is not defined.');
            }
            $id = $rootId;
        }

        return $this;
    }
988049
public function titlePath ($id)
		{
			$category = $this->get($id);

			if ($category == null)
				return null;
			elseif (empty($category->titlePath))
				$this->buildPaths();

			return $category->titlePath;
		}
57145
protected function handleWriteCategory($request, $id = null)
    {
        $category = $id ? $this->getCategory($id) : null;

        $form = $this->formFactory->createNamed(null, 'sonata_classification_api_form_category', $category, [
            'csrf_protection' => false,
        ]);

        FormHelper::removeFields($request->request->all(), $form);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $category = $form->getData();
            $this->categoryManager->save($category);

            $context = new Context();
            $context->setGroups(['sonata_api_read']);

            $view = FOSRestView::create($category);
            $view->setContext($context);

            return $view;
        }

        return $form;
    }
1368841
public function getCategory()
    {
        if (empty($this->category)) {
            throw new LogicException(
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'category')
            );
        }
        return $this->category;
    }
658853
public function addParentCategory(CategoryInterface $category): CategoryInterface
    {
        if (!$this->hasParentCategory($category)) {
            $this->parentCategories->add($category);
        }

        return $this;
    }
1106051
public function findOrFail($id)
    {
        $term = $this->find($id);

        if (! $term->getAdaptee()) {
            throw new QueryException("Taxonomy [{$this->slug}] could not find term [{$id}].");
        }

        return $term;
    }
942177
public function setId(int $id): Folder
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
874501
protected function setCategory($category_id)
    {
        $options = array(
            'category_id' => $category_id,
            'language' => $this->langcode,
            'store_id' => $this->store_id
        );

        $this->data_category = $this->category->get($options);

        if (empty($this->data_category['status'])) {
            $this->outputHttpStatus(404);
        }

        $this->prepareCategory($this->data_category);
    }
1031555
protected function getCategory($id)
    {
        $category = $this->categoryManager->find($id);

        if (null === $category) {
            throw new NotFoundHttpException(sprintf('Category (%d) not found', $id));
        }

        return $category;
    }
676020
public function actionSwitchShow($id)
    {
        $category = Category::findOne($id);
        if (!empty($category)) {
            $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY);
            $category->show = !$category->show;
            $category->save();
            $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY,
                new CategoryEvent(['id' => $id]));
            if (\Yii::$app->request->isAjax) {
                return $category->show;
            }
            return $this->actionIndex();
        } else throw new NotFoundHttpException();
    }
242376
public function remove(int $id): PodiumResponse
    {
        $categoryRemover = $this->getRemover($id);

        if ($categoryRemover === null) {
            throw new ModelNotFoundException('Category of given ID can not be found.');
        }

        return $categoryRemover->remove();
    }
1000491
public function setId(int $id): Website
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
614563
public function move(int $id, ModelInterface $category): PodiumResponse
    {
        $forumMover = $this->getMover($id);

        if ($forumMover === null) {
            throw new ModelNotFoundException('Forum of given ID can not be found.');
        }

        $forumMover->prepareCategory($category);

        return $forumMover->move();
    }
25850
public function edit($id = null)
    {
        $application = $this->applications->getApplication($id);
        $settings = $this->applications->getSettingsForApplication($application);

        if ($settings !== null) {
            $settingsByCategory = $settings->transform(function ($item) {
                if (! $item->category) {
                    $item->category = 'Settings';
                }

                return $item;
            })->groupBy('category');

            // Move 'Settings' category to the start
            if (isset($settingsByCategory['Settings'])) {
                $defaultCategory = $settingsByCategory->pull('Settings');

                $settingsByCategory->prepend($defaultCategory, 'Settings');
            }
        }

        return soda_cms_view('data.settings.view', compact('application', 'settingsByCategory'));
    }
1372042
public function handleEdit(int $id)
    {
        if ($this->presenter->isAjax())
        {
            $this->categoryId = $id;
            $this->onOpen();
        }
    }