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


PHP Query::triggerBeforeFind方法代码示例

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


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

示例1: triggerBeforeFind

 /**
  * Cake\ORM\Query::triggerBeforeFind overwritten to add the condition `deleted IS NULL` to every find request
  * in order not to return soft deleted records.
  * If the query contains the option `withDeleted` the condition `deleted IS NULL` is not applied.
  */
 public function triggerBeforeFind()
 {
     if (!$this->_beforeFindFired && $this->_type === 'select') {
         parent::triggerBeforeFind();
         $aliasedField = $this->repository()->aliasField($this->repository()->getSoftDeleteField());
         if (!is_array($this->getOptions()) || !in_array('withDeleted', $this->getOptions())) {
             $this->andWhere($aliasedField . ' = 1');
         }
     }
 }
开发者ID:oxenti,项目名称:soft-delete,代码行数:15,代码来源:Query.php

示例2: _dispatchBeforeFind

 /**
  * Triggers beforeFind on the target table for the query this association is
  * attaching to
  *
  * @param \Cake\ORM\Query $query the query this association is attaching itself to
  * @return void
  */
 protected function _dispatchBeforeFind($query)
 {
     $query->triggerBeforeFind();
 }
开发者ID:m1nd53t,项目名称:cakephp,代码行数:11,代码来源:Association.php


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