当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectManager::createNativeQuery方法代码示例

本文整理汇总了PHP中Doctrine\Common\Persistence\ObjectManager::createNativeQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManager::createNativeQuery方法的具体用法?PHP ObjectManager::createNativeQuery怎么用?PHP ObjectManager::createNativeQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Persistence\ObjectManager的用法示例。


在下文中一共展示了ObjectManager::createNativeQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: countByAssetCollection

 /**
  * Count assets by asset collection
  *
  * @param AssetCollection $assetCollection
  * @return integer
  */
 public function countByAssetCollection(AssetCollection $assetCollection)
 {
     $rsm = new ResultSetMapping();
     $rsm->addScalarResult('c', 'c');
     $queryString = "SELECT count(a.persistence_object_identifier) c FROM typo3_media_domain_model_asset a LEFT JOIN typo3_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE collectionmm.media_assetcollection = ? AND a.dtype != 'typo3_media_imagevariant'";
     $query = $this->entityManager->createNativeQuery($queryString, $rsm);
     $query->setParameter(1, $assetCollection);
     return $query->getSingleScalarResult();
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:15,代码来源:AssetRepository.php

示例2: displayStatsAction

 public function displayStatsAction()
 {
     $queryString = "SELECT worldviewIdentifier as worldview, count(*) AS count FROM sfi_encult_domain_model_vote GROUP BY worldviewIdentifier;";
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping();
     $rsm->addScalarResult('worldview', 'worldview');
     $rsm->addScalarResult('count', 'count');
     $query = $this->entityManager->createNativeQuery($queryString, $rsm);
     $voteResults = array();
     foreach ($query->getResult() as $row) {
         if ($row['worldview']) {
             $worldviewNode = $this->liveContext->getNodeByIdentifier($row['worldview']);
             $voteResults[$worldviewNode->getProperty('title')] = $row['count'];
         }
     }
     $this->view->assign('voteResults', $voteResults);
 }
开发者ID:alexkuklin,项目名称:EncultDistr,代码行数:16,代码来源:VoteController.php

示例3: countByTag

 /**
  * Counts Assets with the given Tag assigned
  *
  * @param \TYPO3\Media\Domain\Model\Tag $tag
  * @param AssetCollection $assetCollection
  * @return integer
  */
 public function countByTag(\TYPO3\Media\Domain\Model\Tag $tag, AssetCollection $assetCollection = NULL)
 {
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping();
     $rsm->addScalarResult('c', 'c');
     if ($assetCollection === NULL) {
         $queryString = 'SELECT count(a.persistence_object_identifier) c FROM typo3_media_domain_model_asset a LEFT JOIN typo3_media_domain_model_asset_tags_join mm ON a.persistence_object_identifier = mm.media_asset WHERE mm.media_tag = ?';
     } else {
         $queryString = 'SELECT count(a.persistence_object_identifier) c FROM typo3_media_domain_model_asset a LEFT JOIN typo3_media_domain_model_asset_tags_join tagmm ON a.persistence_object_identifier = tagmm.media_asset LEFT JOIN typo3_media_domain_model_assetcollection_assets_join collectionmm ON a.persistence_object_identifier = collectionmm.media_asset WHERE tagmm.media_tag = ? AND collectionmm.media_assetcollection = ?';
     }
     $query = $this->entityManager->createNativeQuery($queryString, $rsm);
     $query->setParameter(1, $tag);
     if ($assetCollection !== NULL) {
         $query->setParameter(2, $assetCollection);
     }
     return $query->getSingleScalarResult();
 }
开发者ID:netlogix,项目名称:media,代码行数:23,代码来源:AssetRepository.php


注:本文中的Doctrine\Common\Persistence\ObjectManager::createNativeQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。