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


PHP Query::func方法代码示例

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


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

 /**
  * {@inheritdoc}
  */
 public function apply($fromAlias, $fromIdentifier, $resourcePrefix, array $requesterIdentifiers, $mask, array $orX = [])
 {
     $this->query->join(['table' => $this->getAclSchema()->getPermissionsTableName(), 'alias' => 'acl_p', 'type' => 'LEFT', 'conditions' => $this->query->newExpr()->eq('acl_p.resource', $this->query->func()->concat([':acl_resource_prefix' => 'literal', $fromAlias . '.' . $fromIdentifier => 'literal']))]);
     $orX[] = $this->query->newExpr()->and_([$this->query->newExpr()->in('acl_p.requester', $requesterIdentifiers, 'string'), $this->query->newExpr(':acl_mask = (acl_p.mask & :acl_mask)')]);
     $this->query->andWhere($this->query->newExpr()->or_($orX));
     $this->query->bind(':acl_resource_prefix', $resourcePrefix);
     $this->query->bind(':acl_mask', $mask, 'integer');
     return $this->query;
 }
开发者ID:alexdpy,项目名称:acl,代码行数:12,代码来源:CakephpOrmAclFilter.php

示例3: findMeetingsThisMonth

 public function findMeetingsThisMonth(Query $query, $options = [])
 {
     $defaultOptions = ['results' => 5];
     $options = array_merge($defaultOptions, $options);
     // override defaultoptions
     $dateFrom = new DateTime('first day of this month');
     $query->hydrate(false)->select(['Users.name', 'totalMeetings' => $query->func()->count('Meetings.id')])->matching('Meetings')->where(['Meetings.date >=' => $dateFrom->format('Y-m-d')])->group(['Users.name'])->orderDesc('totalMeetings')->limit($options['results']);
     return $query;
 }
开发者ID:bolshas,项目名称:voffice,代码行数:9,代码来源:UsersTable.php

示例4: findAveragePerYear

 public function findAveragePerYear(Query $query, $options = [])
 {
     $year = $query->func()->year(['Salaries.from_date' => 'literal']);
     return $query->select(['year' => $year])->find('average')->group([$year]);
 }
开发者ID:surjit,项目名称:cakephp3-advanced-examples,代码行数:5,代码来源:SalariesTable.php

示例5: findWorldLifeExpectancy

 public function findWorldLifeExpectancy(Query $query)
 {
     return $query->select(['avg' => $query->func()->avg('life_expectancy')]);
 }
开发者ID:AFPA-Dijon,项目名称:afpa,代码行数:4,代码来源:CountriesTable.php

示例6: findFemaleRatio

 public function findFemaleRatio(Query $query, $options = [])
 {
     $allManagers = $this->find()->select($query->func()->count('*'));
     return $query->find('female')->select(['female_ratio' => $query->newExpr($query->func()->count('*'))->add($allManagers)->type('/')]);
 }
开发者ID:surjit,项目名称:cakephp3-advanced-examples,代码行数:5,代码来源:ManagersTable.php

示例7: findAverageLifeExpectancy

 public function findAverageLifeExpectancy(Query $query)
 {
     return $query->select(['average_exp' => $query->func()->avg('life_expectancy')]);
 }
开发者ID:harikt,项目名称:cakephp3-examples,代码行数:4,代码来源:CountriesTable.php

示例8: findVencido

 public function findVencido(Query $query, array $options)
 {
     return $query->find('pago')->where(['vencimento <' => $query->func()->now()]);
 }
开发者ID:richellyitalo,项目名称:estudoscakephp,代码行数:4,代码来源:AnunciosTable.php


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