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


PHP Query::addDefaultTypes方法代码示例

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


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

示例1: _appendJunctionJoin

 /**
  * Append a join to the junction table.
  *
  * @param \Cake\ORM\Query $query The query to append.
  * @param string|array $conditions The query conditions to use.
  * @return \Cake\ORM\Query The modified query.
  */
 protected function _appendJunctionJoin($query, $conditions)
 {
     $name = $this->_junctionAssociationName();
     $joins = $query->join();
     $matching = [$name => ['table' => $this->junction()->table(), 'conditions' => $conditions, 'type' => 'INNER']];
     $assoc = $this->target()->association($name);
     $query->addDefaultTypes($assoc->target())->join($matching + $joins, [], true);
     $query->eagerLoader()->addToJoinsMap($name, $assoc);
     return $query;
 }
开发者ID:Mingyangzu,项目名称:PHP-cakephp,代码行数:17,代码来源:BelongsToMany.php

示例2: _appendFields

 /**
  * Helper function used to conditionally append fields to the select clause of
  * a query from the fields found in another query object.
  *
  * @param \Cake\ORM\Query $query the query that will get the fields appended to
  * @param \Cake\ORM\Query $surrogate the query having the fields to be copied from
  * @param array $options options passed to the method `attachTo`
  * @return void
  */
 protected function _appendFields($query, $surrogate, $options)
 {
     if ($query->eagerLoader()->autoFields() === false) {
         return;
     }
     $fields = $surrogate->clause('select') ?: $options['fields'];
     $target = $this->_targetTable;
     $autoFields = $surrogate->autoFields();
     if (empty($fields) && !$autoFields) {
         if ($options['includeFields'] && ($fields === null || $fields !== false)) {
             $fields = $target->schema()->columns();
         }
     }
     if ($autoFields === true) {
         $fields = array_merge((array) $fields, $target->schema()->columns());
     }
     if (!empty($fields)) {
         $query->select($query->aliasFields($fields, $target->alias()));
     }
     $query->addDefaultTypes($target);
 }
开发者ID:AmuseXperience,项目名称:api,代码行数:30,代码来源:Association.php


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