load() public method

Get language by id.
public load ( mixed $id ) : eZ\Publish\SPI\Persistence\Content\Language
$id mixed
return eZ\Publish\SPI\Persistence\Content\Language
 /**
  * Inserts a new content object.
  *
  * @param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct
  * @param mixed $currentVersionNo
  *
  * @return int ID
  */
 public function insertContentObject(CreateStruct $struct, $currentVersionNo = 1)
 {
     $initialLanguageCode = $this->languageHandler->load($struct->initialLanguageId)->languageCode;
     if (isset($struct->name[$initialLanguageCode])) {
         $name = $struct->name[$initialLanguageCode];
     } else {
         $name = '';
     }
     $q = $this->dbHandler->createInsertQuery();
     $q->insertInto($this->dbHandler->quoteTable('ezcontentobject'))->set($this->dbHandler->quoteColumn('id'), $this->dbHandler->getAutoIncrementValue('ezcontentobject', 'id'))->set($this->dbHandler->quoteColumn('current_version'), $q->bindValue($currentVersionNo, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('name'), $q->bindValue($name, null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn('contentclass_id'), $q->bindValue($struct->typeId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('section_id'), $q->bindValue($struct->sectionId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('owner_id'), $q->bindValue($struct->ownerId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('initial_language_id'), $q->bindValue($struct->initialLanguageId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('remote_id'), $q->bindValue($struct->remoteId, null, \PDO::PARAM_STR))->set($this->dbHandler->quoteColumn('modified'), $q->bindValue(0, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('published'), $q->bindValue(0, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('status'), $q->bindValue(ContentInfo::STATUS_DRAFT, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('language_mask'), $q->bindValue($this->generateLanguageMask($struct->fields, $struct->alwaysAvailable), null, \PDO::PARAM_INT));
     $q->prepare()->execute();
     return $this->dbHandler->lastInsertId($this->dbHandler->getSequenceName('ezcontentobject', 'id'));
 }
 /**
  * Loads the actual content based on the provided IDs
  *
  * @param array $contentIds
  * @param mixed $translations
  *
  * @return mixed[]
  */
 protected function loadContent(array $contentIds, $translations)
 {
     $loadQuery = $this->queryBuilder->createFindQuery($translations);
     $loadQuery->where($loadQuery->expr->eq('ezcontentobject_version.status', VersionInfo::STATUS_PUBLISHED), $loadQuery->expr->in($this->handler->quoteColumn('id', 'ezcontentobject'), $contentIds));
     $statement = $loadQuery->prepare();
     $statement->execute();
     $rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
     // Sort array, as defined in the $contentIds array
     $contentIdOrder = array_flip($contentIds);
     usort($rows, function ($current, $next) use($contentIdOrder) {
         return $contentIdOrder[$current['ezcontentobject_id']] - $contentIdOrder[$next['ezcontentobject_id']];
     });
     foreach ($rows as &$row) {
         $row['ezcontentobject_always_available'] = $this->languageMaskGenerator->isAlwaysAvailable($row['ezcontentobject_language_mask']);
         $row['ezcontentobject_main_language_code'] = $this->languageHandler->load($row['ezcontentobject_initial_language_id'])->languageCode;
         $row['ezcontentobject_version_languages'] = $this->languageMaskGenerator->extractLanguageIdsFromMask($row['ezcontentobject_version_language_mask']);
         $row['ezcontentobject_version_initial_language_code'] = $this->languageHandler->load($row['ezcontentobject_version_initial_language_id'])->languageCode;
     }
     return $rows;
 }
 /**
  * Updates version $versionNo for content identified by $contentId, in respect to $struct.
  *
  * @param int $contentId
  * @param int $versionNo
  * @param \eZ\Publish\SPI\Persistence\Content\UpdateStruct $struct
  */
 public function updateVersion($contentId, $versionNo, UpdateStruct $struct)
 {
     $q = $this->dbHandler->createUpdateQuery();
     $q->update($this->dbHandler->quoteTable('ezcontentobject_version'))->set($this->dbHandler->quoteColumn('creator_id'), $q->bindValue($struct->creatorId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('modified'), $q->bindValue($struct->modificationDate, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('initial_language_id'), $q->bindValue($struct->initialLanguageId, null, \PDO::PARAM_INT))->set($this->dbHandler->quoteColumn('language_mask'), $q->expr->bitOr($this->dbHandler->quoteColumn('language_mask'), $q->bindValue($this->generateLanguageMask($struct->fields, $this->languageHandler->load($struct->initialLanguageId)->languageCode, false), null, \PDO::PARAM_INT)))->where($q->expr->lAnd($q->expr->eq($this->dbHandler->quoteColumn('contentobject_id'), $q->bindValue($contentId, null, \PDO::PARAM_INT)), $q->expr->eq($this->dbHandler->quoteColumn('version'), $q->bindValue($versionNo, null, \PDO::PARAM_INT))));
     $q->prepare()->execute();
 }