当前位置: 首页>>代码示例>>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;未经允许,请勿转载。