Smile\ElasticsuiteThesaurus\Model\ThesaurusRepository::getById PHP Method

getById() public method

Retrieve a thesaurus by its ID
public getById ( integer $thesaurusId ) : Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface
$thesaurusId integer id of the thesaurus
return Smile\ElasticsuiteThesaurus\Api\Data\ThesaurusInterface
    public function getById($thesaurusId)
    {
        if (!isset($this->thesaurusRepositoryById[$thesaurusId])) {
            /** @var ThesaurusInterface $thesaurus */
            $thesaurus = $this->thesaurusFactory->create()->load($thesaurusId);
            if (!$thesaurus->getThesaurusId()) {
                $exception = new NoSuchEntityException();
                throw $exception->singleField('thesaurusId', $thesaurusId);
            }
            $this->thesaurusRepositoryById[$thesaurusId] = $thesaurus;
        }
        return $this->thesaurusRepositoryById[$thesaurusId];
    }