eZ\Publish\Core\Persistence\Legacy\Content\Language\CachingHandler::load PHP Méthode

load() public méthode

Get language by id.
public load ( mixed $id ) : eZ\Publish\SPI\Persistence\Content\Language
$id mixed
Résultat eZ\Publish\SPI\Persistence\Content\Language
    public function load($id)
    {
        $this->initializeCache();
        return $this->languageCache->getById($id);
    }

Usage Example

 /**
  * 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'));
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\Language\CachingHandler::load