extractLanguageIdsFromMask() public method

Extracts every language Ids contained in $languageMask.
public extractLanguageIdsFromMask ( integer $languageMask ) : array
$languageMask integer
return array Array of language Id
Beispiel #1
0
 /**
  * Extracts a Tag object from $row.
  *
  * @param array $rows
  *
  * @return \Netgen\TagsBundle\SPI\Persistence\Tags\Tag[]
  */
 public function extractTagListFromRows(array $rows)
 {
     $tagList = array();
     foreach ($rows as $row) {
         $tagId = (int) $row['eztags_id'];
         if (!isset($tagList[$tagId])) {
             $tag = new Tag();
             $tag->id = (int) $row['eztags_id'];
             $tag->parentTagId = (int) $row['eztags_parent_id'];
             $tag->mainTagId = (int) $row['eztags_main_tag_id'];
             $tag->keywords = array();
             $tag->depth = (int) $row['eztags_depth'];
             $tag->pathString = $row['eztags_path_string'];
             $tag->modificationDate = (int) $row['eztags_modified'];
             $tag->remoteId = $row['eztags_remote_id'];
             $tag->alwaysAvailable = (int) $row['eztags_language_mask'] & 1 ? true : false;
             $tag->mainLanguageCode = $this->languageHandler->load($row['eztags_main_language_id'])->languageCode;
             $tag->languageIds = $this->languageMaskGenerator->extractLanguageIdsFromMask((int) $row['eztags_language_mask']);
             $tagList[$tagId] = $tag;
         }
         if (!isset($tagList[$tagId]->keywords[$row['eztags_keyword_locale']])) {
             $tagList[$tagId]->keywords[$row['eztags_keyword_locale']] = $row['eztags_keyword_keyword'];
         }
     }
     return array_values($tagList);
 }
 /**
  * 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;
 }