createQuery() ->where('parent_id IS NULL') ->execute(); } public function getParentsInMenu() { return $this->createQuery() ->where('parent_id IS NULL') ->addWhere('in_menu = ?', true) ->execute(); } public function findOneBySlugInVersion($slug) { $id = $this->createQuery() ->select('id') ->from('PageVersion') ->where('slug = ?', $slug) ->fetchOne(); return $id ? $this->find($id) : false; } /* * Lucene vyhledavani */ static public function getLuceneIndex() { ProjectConfiguration::registerZend(); if (file_exists($index = self::getLuceneIndexFile())) { return Zend_Search_Lucene::open($index); } else { return Zend_Search_Lucene::create($index); } } static public function getLuceneIndexFile() { return sfConfig::get('sf_data_dir').'/lucene/page.'.sfConfig::get('sf_environment').'.index'; } public function getForLuceneQuery($query) { $hits = $this->getLuceneIndex()->find($query); $pks = array(); foreach ($hits as $hit) { $pks[] = $hit->pk; } if (empty($pks)) { return array(); } $q = $this->createQuery('p') ->whereIn('p.id', $pks) ->limit(20); return $q->execute(); } }