function resortTagItems($dir = 'DESC') { $tag_item = new Dase_DBO_TagItem($this->db); $tag_item->tag_id = $this->id; $tag_item->orderBy('sort_order, updated ' . $dir); $i = 0; foreach ($tag_item->find() as $ti) { $i++; $ti->sort_order = $i; $ti->updated = date(DATE_ATOM); $ti->update(); } }