eZ\Publish\Core\Persistence\Legacy\Content\Language\Cache::getById PHP Method

getById() public method

Returns the Language with $id from the cache.
public getById ( mixed $id ) : eZ\Publish\SPI\Persistence\Content\Language
$id mixed
return eZ\Publish\SPI\Persistence\Content\Language
    public function getById($id)
    {
        if (!isset($this->mapById[$id])) {
            throw new NotFoundException('Language', $id);
        }
        return $this->mapById[$id];
    }

Usage Example

 /**
  * Get language by id.
  *
  * @param mixed $id
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If language could not be found by $id
  *
  * @return \eZ\Publish\SPI\Persistence\Content\Language
  */
 public function load($id)
 {
     $this->initializeCache();
     return $this->languageCache->getById($id);
 }