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


PHP Query::matching方法代码示例

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


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

示例1: findWithCount

 public function findWithCount(Query $query, array $options)
 {
     $query->select(['count' => $query->func()->count('Users.id')]);
     $query->matching('Users');
     $query->group(['UserRoles.id']);
     return $query;
 }
开发者ID:JulienPapini,项目名称:CakeUser,代码行数:7,代码来源:UserRolesTable.php

示例2: findWithCitiesBiggerThanDenmark

 public function findWithCitiesBiggerThanDenmark(Query $query)
 {
     $denmarkPopulation = $this->find()->select(['population'])->where(['id' => 'DNK']);
     return $query->matching('Cities', function ($q) use($denmarkPopulation) {
         return $q->where(['Cities.population >' => $denmarkPopulation]);
     });
 }
开发者ID:harikt,项目名称:cakephp3-examples,代码行数:7,代码来源:CountriesTable.php

示例3: findActive

 /**
  * "Active" find method
  * @param Query $query Query object
  * @param array $options Options
  * @return Query Query object
  */
 public function findActive(Query $query, array $options)
 {
     $query->where([sprintf('%s.active', $this->alias()) => true]);
     $query->matching('Albums', function ($q) {
         return $q->where([sprintf('%s.active', $this->Albums->alias()) => true]);
     });
     return $query;
 }
开发者ID:mirko-pagliai,项目名称:me-cms,代码行数:14,代码来源:PhotosTable.php

示例4: findTagged

 public function findTagged(Query $query, array $options)
 {
     $query->contain(['Users', 'Users.AccountParameters', 'Hashtags']);
     $query->matching('Hashtags', function ($q) use($options) {
         return $q->where(['Hashtags.name' => $options['tag_name']]);
     });
     $query->order(['Tweets.created' => 'DESC']);
     return $query;
 }
开发者ID:TituxMetal,项目名称:Twitthome-CakePHP3,代码行数:9,代码来源:TweetsTable.php

示例5: findCityProbability

 public function findCityProbability(Query $query)
 {
     return $query->matching('Countries.Cities', function ($q) {
         $prob = $q->newExpr('(Languages.percentage / 100) * (Cities.population / Countries.population)');
         return $q->select(['probability' => $prob, 'Cities.name'])->where(function ($exp) use($prob) {
             return $exp->gte($prob, 0.25);
         });
     });
 }
开发者ID:harikt,项目名称:cakephp3-examples,代码行数:9,代码来源:LanguagesTable.php

示例6: findParticipating

 /**
  * Dynamic finder that find threads where given users are involved
  *
  * @param \Cake\ORM\Query $query the original query to append to
  * @param array $users the list of user ids like ```[1, 2, 3]```
  * @return \Cake\ORM\Query The amended query
  */
 public function findParticipating(Query $query, array $users = null)
 {
     if (empty($users)) {
         return $query;
     }
     return $query->matching('Users', function ($q) use($users) {
         return $q->where(['Users.id IN' => $users]);
     });
 }
开发者ID:gintonicweb,项目名称:messages,代码行数:16,代码来源:ThreadsTable.php

示例7: scope

 /**
  * {@inheritDoc}
  */
 public function scope(Query $query, TokenInterface $token)
 {
     $value = $token->value();
     if (empty($value)) {
         return $query;
     }
     return $query->matching('Tags', function ($q) use($value) {
         $value = explode(',', $value);
         $names = array_map('trim', (array) $value);
         return $q->where(['Tags.name IN' => empty($names) ? ['---'] : $names]);
     });
 }
开发者ID:ChristopherCastro,项目名称:gencon,代码行数:15,代码来源:TagOperator.php

示例8: findWithAuthors

 /**
  * Authors search finder
  *
  * @param  Query $query query object instance
  * @return $this
  */
 public function findWithAuthors(Query $query)
 {
     return $query->matching('Authors');
 }
开发者ID:kajko1973,项目名称:plum_search,代码行数:10,代码来源:ArticlesTable.php

示例9: findForMembers

 public function findForMembers(Query $query, array $options)
 {
     return $query->matching('Users.Memberships', function ($q) {
         return $q->where(['Memberships.expires >=' => date('Y-m-d H:i:s')])->where([function ($exp, $q) {
             return $exp->isNull('canceled');
         }]);
     })->distinct(['Tags.id']);
 }
开发者ID:PhantomWatson,项目名称:macc,代码行数:8,代码来源:TagsTable.php

示例10: findByHashtag

 public function findByHashtag(Query $query, array $options)
 {
     return $query->matching('Hashtags', function ($q) use($options) {
         return $q->where(['Hashtags.name' => $options['hashtag']]);
     });
 }
开发者ID:AFPA-Dijon,项目名称:afpa,代码行数:6,代码来源:TweetsTable.php

示例11: findTagged

 public function findTagged(Query $query, $options)
 {
     return $query->matching('Tags', function ($q) use($options) {
         return $q->where(['Tags.title' => $options['tag']]);
     });
 }
开发者ID:nhan712,项目名称:cakephp3-bookmarkr,代码行数:6,代码来源:BookmarksTable.php

示例12: findVencido

 public function findVencido(Query $query, array $options)
 {
     return $query->matching('Anuncio', function ($q) {
         return $q->find('vencido');
     });
 }
开发者ID:richellyitalo,项目名称:estudoscakephp,代码行数:6,代码来源:PropertiesTable.php


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