public function index() { $toc = $this->getOption('toc'); for ($i = 0; $i < count($toc); $i++) { $this->indexSection($toc->getChild($i)); } } public function indexSection(Sensei_Doc_Section $section) { $q = Doctrine_Query::create()->from('Sensei_Doc_Path p')->where('p.path = ?'); $path = $q->execute(array($section->getPath())); if ($path === false) { $path = new Sensei_Doc_Path; $path->path = $section->getPath(); $path->save(); } $fields = array( 'path' => $section->getPath(), 'content' => $section->getText(), 'id' => $path->id ); $this->updateIndex($fields); for ($i = 0; $i < count($section); $i++) { $this->indexSection($section->getChild($i)); } }