本文整理汇总了PHP中eZContentClassName::fetchList方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClassName::fetchList方法的具体用法?PHP eZContentClassName::fetchList怎么用?PHP eZContentClassName::fetchList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClassName
的用法示例。
在下文中一共展示了eZContentClassName::fetchList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
function store($contentClass)
{
if ($this->hasDirtyData() && is_object($contentClass)) {
$classID = $contentClass->attribute('id');
$classVersion = $contentClass->attribute('version');
$languages = $contentClass->attribute('languages');
$initialLanguageID = $contentClass->attribute('initial_language_id');
// update existing
$contentClassNames = eZContentClassName::fetchList($classID, $classVersion, array_keys($languages));
foreach ($contentClassNames as $className) {
$languageLocale = $className->attribute('language_locale');
$className->setAttribute('name', $this->nameByLanguageLocale($languageLocale));
if ($initialLanguageID == $className->attribute('language_id')) {
$className->setAttribute('language_id', $initialLanguageID | 1);
}
$className->sync();
// avoid unnecessary sql-updates if nothing changed
unset($languages[$languageLocale]);
}
// create new
if (count($languages) > 0) {
foreach ($languages as $languageLocale => $language) {
$languageID = $language->attribute('id');
if ($initialLanguageID == $languageID) {
$languageID = $initialLanguageID | 1;
}
$className = new eZContentClassName(array('contentclass_id' => $classID, 'contentclass_version' => $classVersion, 'language_locale' => $languageLocale, 'language_id' => $languageID, 'name' => $this->nameByLanguageLocale($languageLocale)));
$className->store();
}
}
$this->setHasDirtyData(false);
}
}