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


PHP Association::find方法代码示例

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


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

示例1: _deleteFileAssociationRecord

 /**
  * Method that fetches and deletes document-file manyToMany association record Entity.
  *
  * @param  string $id file id
  * @return bool
  */
 protected function _deleteFileAssociationRecord($id)
 {
     $query = $this->_fileStorageAssociation->find('all', ['conditions' => [$this->_fileStorageForeignKey => $id]]);
     $entity = $query->first();
     if (is_null($entity)) {
         return false;
     }
     return $this->_fileStorageAssociation->delete($entity);
 }
开发者ID:QoboLtd,项目名称:cakephp-csv-migrations,代码行数:15,代码来源:FileUploadsUtils.php

示例2: find

 /**
  * Proxies the finding operation to the target table's find method
  * and modifies the query accordingly based of this association
  * configuration.
  *
  * If your association includes conditions, the junction table will be
  * included in the query's contained associations.
  *
  * @param string|array $type the type of query to perform, if an array is passed,
  *   it will be interpreted as the `$options` parameter
  * @param array $options The options to for the find
  * @see \Cake\ORM\Table::find()
  * @return \Cake\ORM\Query
  */
 public function find($type = null, array $options = [])
 {
     $query = parent::find($type, $options);
     if (!$this->conditions()) {
         return $query;
     }
     $belongsTo = $this->junction()->association($this->target()->alias());
     $conditions = $belongsTo->_joinCondition(['foreignKey' => $this->foreignKey()]);
     return $this->_appendJunctionJoin($query, $conditions);
 }
开发者ID:Malek-S,项目名称:cakephp,代码行数:24,代码来源:BelongsToMany.php

示例3: _loadBelongsToMany

 /**
  * Loads a list of belongs to many from ids.
  *
  * @param Association $assoc The association class for the belongsToMany association.
  * @param array $ids The list of ids to load.
  * @return array An array of entities.
  */
 protected function _loadBelongsToMany($assoc, $ids)
 {
     $target = $assoc->target();
     $primaryKey = (array) $target->primaryKey();
     $multi = count($primaryKey) > 1;
     if ($multi) {
         if (count(current($ids)) !== count($primaryKey)) {
             return [];
         }
         $filter = new TupleComparison($primaryKey, $ids, [], 'IN');
     } else {
         $filter = [$primaryKey[0] . ' IN' => $ids];
     }
     return $assoc->find()->where($filter)->toArray();
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:22,代码来源:Marshaller.php


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