public function getById($optimizerId)
    {
        if (!isset($this->optimizerRepositoryById[$optimizerId])) {
            $optimizerModel = $this->optimizerFactory->create();
            $optimizer = $this->entityManager->load($optimizerModel, $optimizerId);
            if (!$optimizer->getId()) {
                throw NoSuchEntityException::singleField('optimizerId', $optimizerId);
            }

            $this->optimizerRepositoryById[$optimizerId] = $optimizer;
        }

        return $this->optimizerRepositoryById[$optimizerId];
    }
public function getById($optimizerId)
    {
        if (!isset($this->optimizerRepositoryById[$optimizerId])) {
            $optimizerModel = $this->optimizerFactory->create();
            $optimizer = $this->entityManager->load($optimizerModel, $optimizerId);
            if (!$optimizer->getId()) {
                throw NoSuchEntityException::singleField('optimizerId', $optimizerId);
            }

            $this->optimizerRepositoryById[$optimizerId] = $optimizer;
        }

        return $this->optimizerRepositoryById[$optimizerId];
    }
public function getById ( $ optimizerId ) { if ( ! isset ( $ this -> optimizerRepositoryById [ $ optimizerId ] ) ) { $ optimizerModel = $ this -> optimizerFactory -> create ( ) ; $ optimizer = $ this -> entityManager -> load ( $ optimizerModel , $ optimizerId ) ; if ( ! $ optimizer -> getId ( ) ) { throw NoSuchEntityException :: singleField ( 'optimizerId' , $ optimizerId ) ; } $ this -> optimizerRepositoryById [ $ optimizerId ] = $ optimizer ; } return $ this -> optimizerRepositoryById [ $ optimizerId ] ; }
Retrieve a optimizer by its ID

@SuppressWarnings(PHPMD.StaticAccess) Mandatory to throw the exception via static access to be compliant
with Magento Extension Quality Program

@param int $optimizerId Id of the optimizer.

@return \Smile\ElasticsuiteCatalogOptimizer\Api\Data\OptimizerInterface
@throws \Magento\Framework\Exception\NoSuchEntityException
Retrieve a optimizer by its ID