當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DocumentManager::createQuery方法代碼示例

本文整理匯總了PHP中Doctrine\ODM\PHPCR\DocumentManager::createQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::createQuery方法的具體用法?PHP DocumentManager::createQuery怎麽用?PHP DocumentManager::createQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ODM\PHPCR\DocumentManager的用法示例。


在下文中一共展示了DocumentManager::createQuery方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testQuery

 /**
  * @dataProvider queryStatements
  */
 public function testQuery($statement, $rowCount)
 {
     if ($rowCount == -1) {
         // magic to tell this is an invalid query
         $this->setExpectedException('PHPCR\\Query\\InvalidQueryException');
     }
     $query = $this->dm->createQuery($statement, \PHPCR\Query\QueryInterface::JCR_SQL2);
     $this->assertInstanceOf('Doctrine\\ODM\\PHPCR\\Query\\Query', $query);
     $result = $query->execute();
     $this->assertCount($rowCount, $result);
 }
開發者ID:steffenbrem,項目名稱:phpcr-odm,代碼行數:14,代碼來源:QuerySql2Test.php

示例2: load

 /**
  * {@inheritdoc}.
  */
 public function load($sitemap)
 {
     // todo rewrite query when https://github.com/symfony-cmf/CoreBundle/issues/126 is ready
     $documentsCollection = $this->manager->createQuery('SELECT * FROM [nt:unstructured] WHERE (visible_for_sitemap = true)', QueryInterface::JCR_SQL2)->execute();
     $documents = array();
     // the chain provider does not like collections as we array_merge in there
     foreach ($documentsCollection as $document) {
         $documents[] = $document;
     }
     return $documents;
 }
開發者ID:damonsson,項目名稱:SeoBundle,代碼行數:14,代碼來源:SitemapDocumentProvider.php

示例3: getPagesByTags

 /**
  * Connect to Jackrabbit, and filter pages by tags
  *
  * @param $tags array with stanbol references
  * @param $currentUrl string current url
  * @param $lang string language
  *
  * @return array with links to pages
  */
 protected function getPagesByTags($tags, $currentUrl, $lang)
 {
     $this->basePath = $this->basePath . '/' . $lang;
     foreach ($tags as $i => $tag) {
         $tags[$i] = 'referring.tags = ' . $this->dm->quote($tag);
     }
     $sql = 'SELECT routes.* FROM [nt:unstructured] AS routes';
     $sql .= ' INNER JOIN [nt:unstructured] AS referring ON referring.[jcr:uuid] = routes.[routeContent]';
     $sql .= ' WHERE (ISDESCENDANTNODE(routes, ' . $this->dm->quote($this->basePath) . ') OR ISSAMENODE(routes, ' . $this->dm->quote($this->basePath) . '))';
     $sql .= ' AND (' . implode(' OR ', $tags) . ')';
     $query = $this->dm->createQuery($sql, QueryInterface::JCR_SQL2);
     $query->setLimit(-1);
     $pages = $this->dm->getDocumentsByQuery($query);
     $links = array();
     foreach ($pages as $page) {
         if ($page instanceof Route && $page->getRouteContent()) {
             $url = $this->router->generate('', array('_locale' => $lang, 'content' => $page->getRouteContent()), true);
             if (preg_replace('/^\\/|\\/$/', '', $url) !== preg_replace('/^\\/|\\/$/', '', $currentUrl)) {
                 $label = $page->getRouteContent()->title;
                 $links[] = array('url' => $url, 'label' => $label);
             }
         }
     }
     return $links;
 }
開發者ID:richardmiller,項目名稱:LiipVieBundle,代碼行數:34,代碼來源:AssetsController.php

示例4: fetchSitemapDocuments

 /**
  * Wrapper to fetch the sitemap documents from database.
  *
  * @return object[]
  *
  * @throws QueryException
  */
 protected function fetchSitemapDocuments()
 {
     // todo rewrite query when https://github.com/symfony-cmf/CoreBundle/issues/126 is ready
     return $this->manager->createQuery("SELECT * FROM [nt:unstructured] WHERE (visible_for_sitemap = true)", QueryInterface::JCR_SQL2)->execute();
 }
開發者ID:BiffBangPow,項目名稱:SeoBundle,代碼行數:12,代碼來源:SitemapUrlInformationProvider.php


注:本文中的Doctrine\ODM\PHPCR\DocumentManager::createQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。