public function getTranslatedTo($flag = false) { static $result_children = array(); static $language_ids = array(); if ($flag) { $result_children = array(); $language_ids = array(); } $children = $this->dbQuery('SELECT id, language FROM slide WHERE translated_from=:id', array('id' => $this->slide_id)); if (count($children)) { foreach ($children as $slide) { $child_obj = new Slide(); $child_obj->slide_id = $slide['id']; $language_array = explode('-', $slide['language']); $language['id'] = $language_array[0]; $language['name'] = $language_array[1]; if (!in_array($language['id'], $language_ids)) { $child = array(); $child['id'] = $slide['id']; $child['language']['id'] = $language['id']; $child['language']['name'] = $language['name']; $language_ids[] = $language['id']; $result_children[] = $child; } $child_obj->getTranslatedTo(); } } return $result_children; }