/** * Gets collection of siblings and parent for this make * @param DBModel $model * @return type */ function get_related_models(DBModel $model) { $related_models = array(); if ($model->is_parent()) { foreach (get_children_models($model) as $item) { $related_model[] = $item; } } else { foreach (get_sibling_models($model) as $item) { $related_models[] = $item; } } $related_models[] = get_parent_model($model); return $related_models; }