/** * @param Model $obj * @return array * @throws Exception */ protected function do_create_array(Model $obj) { $parent = 0; if ($obj->get_parent() !== null) { if ($obj->get_parent()->get_term() !== null) { $parent = $obj->get_parent()->get_term()->get_id(); } } $term = $obj->get_term(); if (!$term instanceof Term) { throw new Exception('Taxonomy is missing a valid term.'); } return array('term_id' => $term->get_id(), 'taxonomy' => $obj->get_taxonomy(), 'description' => $obj->get_description(), 'parent' => $parent, 'count' => $obj->get_count()); }