本文整理汇总了PHP中Apartment::getCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::getCategories方法的具体用法?PHP Apartment::getCategories怎么用?PHP Apartment::getCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::getCategories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategoriesForUpdate
/** Сохраняем данные выбранных справочников
* @return array
*/
public static function getCategoriesForUpdate(Apartment $ad)
{
if (isset($_POST['category']) && is_array($_POST['category'])) {
$ad->references = Apartment::getCategories(null, $ad->type);
foreach ($_POST['category'] as $cat => $categoryArray) {
foreach ($categoryArray as $key => $value) {
$ad->references[$cat]['values'][$key]['selected'] = true;
}
}
} else {
$ad->references = Apartment::getCategories($ad->id, $ad->type);
}
return $ad->references;
}
示例2: getCategoriesForUpdate
public function getCategoriesForUpdate()
{
if (isset($_POST['category']) && is_array($_POST['category'])) {
$this->references = Apartment::getCategories(null, $this->type);
foreach ($_POST['category'] as $cat => $cat_arr) {
foreach ($cat_arr as $cat_key => $cat_value) {
$this->references[$cat]['values'][$cat_key]['selected'] = true;
}
}
} else {
$this->references = Apartment::getCategories($this->id, $this->type);
}
return $this->references;
}