當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Query::getOptions方法代碼示例

本文整理匯總了PHP中Cake\ORM\Query::getOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Query::getOptions方法的具體用法?PHP Query::getOptions怎麽用?PHP Query::getOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\ORM\Query的用法示例。


在下文中一共展示了Query::getOptions方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeFind

 /**
  * beforeFind
  * @param Event $event
  * @param Query $query
  * @param ArrayObject $options
  * @param $primary
  */
 public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
 {
     $getOptions = $query->getOptions();
     if (!array_key_exists('enableSoftDelete', $getOptions) || $getOptions['enableSoftDelete'] == true) {
         $modelName = $this->_table->alias();
         $booleanField = $this->config('boolean');
         $timestampField = $this->config('timestamp');
         if ($booleanField !== false && $this->_table->hasField($booleanField)) {
             $query->where([$modelName . '.' . $booleanField => false]);
         }
         if ($booleanField === false && $timestampField !== false && $this->_table->hasField($timestampField)) {
             $query->where([$modelName . '.' . $timestampField . ' IS' => null]);
         }
     }
 }
開發者ID:fusic,項目名稱:reincarnation,代碼行數:22,代碼來源:SoftDeleteBehavior.php

示例2: testGetOptions

 /**
  * Tests getOptions() method
  *
  * @return void
  */
 public function testGetOptions()
 {
     $options = ['doABarrelRoll' => true, 'fields' => ['id', 'name']];
     $query = new Query($this->connection, $this->table);
     $query->applyOptions($options);
     $expected = ['doABarrelRoll' => true];
     $this->assertEquals($expected, $query->getOptions());
     $expected = ['doABarrelRoll' => false, 'doAwesome' => true];
     $query->applyOptions($expected);
     $this->assertEquals($expected, $query->getOptions());
 }
開發者ID:neilan35,項目名稱:betterwindow1,代碼行數:16,代碼來源:QueryTest.php

示例3: callFinder

 /**
  * Calls a finder method directly and applies it to the passed query,
  * if no query is passed a new one will be created and returned
  *
  * @param string $type name of the finder to be called
  * @param \Cake\ORM\Query $query The query object to apply the finder options to
  * @param array $options List of options to pass to the finder
  * @return \Cake\ORM\Query
  * @throws \BadMethodCallException
  */
 public function callFinder($type, Query $query, array $options = [])
 {
     $query->applyOptions($options);
     $options = $query->getOptions();
     $finder = 'find' . $type;
     if (method_exists($this, $finder)) {
         return $this->{$finder}($query, $options);
     }
     if ($this->_behaviors && $this->_behaviors->hasFinder($type)) {
         return $this->_behaviors->callFinder($type, [$query, $options]);
     }
     throw new \BadMethodCallException(sprintf('Unknown finder method "%s"', $type));
 }
開發者ID:yao-dev,項目名稱:blog-mvc.github.io,代碼行數:23,代碼來源:Table.php

示例4: _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)
 {
     $table = $this->target();
     $options = $query->getOptions();
     $table->dispatchEvent('Model.beforeFind', [$query, new \ArrayObject($options), false]);
 }
開發者ID:neilan35,項目名稱:betterwindow1,代碼行數:13,代碼來源:Association.php

示例5: _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)
 {
     $table = $this->target();
     $options = $query->getOptions();
     $event = new Event('Model.beforeFind', $table, [$query, $options, false]);
     $table->getEventManager()->dispatch($event);
 }
開發者ID:ripzappa0924,項目名稱:carte0.0.1,代碼行數:14,代碼來源:Association.php


注:本文中的Cake\ORM\Query::getOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。