本文整理汇总了PHP中Localization::CN方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::CN方法的具体用法?PHP Localization::CN怎么用?PHP Localization::CN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization::CN方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPageLocalization
/**
* Get link page localization
* @return Localization
*/
public function getPageLocalization()
{
throw new \Exception('Dont use me bro.');
if (empty($this->pageId)) {
return;
}
if (!is_null($this->pageLocalization)) {
return $this->pageLocalization;
}
$em = ObjectRepository::getEntityManager($this);
$pageData = null;
$localizationEntity = Localization::CN();
$localeId = ObjectRepository::getLocaleManager($this)->getCurrent()->getId();
$criteria = array('master' => $this->pageId, 'locale' => $localeId);
// Now master page ID is stored, still the old implementation is working
$dql = "SELECT l, m, p FROM {$localizationEntity} l\n\t\t\t\tJOIN l.master m\n\t\t\t\tLEFT JOIN l.path p\n\t\t\t\tWHERE (l.master = :master AND l.locale= :locale)\n\t\t\t\tOR l.id = :master";
try {
$pageData = $em->createQuery($dql)->setParameters($criteria)->getSingleResult();
} catch (NoResultException $noResult) {
// Special case for group page selection when no localization exists in database
$master = $em->find(GroupPage::CN(), $this->pageId);
if ($master instanceof GroupPage) {
$pageData = $master->getLocalization($localeId);
}
}
// Cache the result
$this->pageLocalization = $pageData;
return $pageData;
}