/** * Import term. * * @param Term $term */ public function import_term(Term $term) { // Term ID on production environment. $term_id = $this->term_dao->get_term_id_by_slug($term->get_slug()); $term->set_id($term_id); if (!$term->get_id()) { // This term does not exist on production, create it. $this->term_dao->insert($term); } else { // This term exists on production, update it. $this->term_dao->update_term($term); } }
/** * @param array $raw * @return Term */ protected function do_create_object(array $raw) { $obj = new Term($raw['term_id']); $obj->set_name($raw['name']); $obj->set_slug($raw['slug']); $obj->set_group($raw['term_group']); return $obj; }