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


PHP Doctrine_Relation类代码示例

本文整理汇总了PHP中Doctrine_Relation的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Relation类的具体用法?PHP Doctrine_Relation怎么用?PHP Doctrine_Relation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildAssociativeRelationSql

 protected function buildAssociativeRelationSql(Doctrine_Relation $relation, $assocAlias, $foreignAlias, $localAlias)
 {
     $table = $relation->getTable();
     $queryPart = ' ON ';
     if ($relation->isEqual()) {
         $queryPart .= '(';
     }
     $localIdentifier = $table->getColumnName($table->getIdentifier());
     $queryPart .= $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) . ' = ' . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeignRefColumnName());
     if ($relation->isEqual()) {
         $queryPart .= ' OR ' . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) . ' = ' . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocalRefColumnName()) . ') AND ' . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) . ' != ' . $this->_conn->quoteIdentifier($localAlias . '.' . $localIdentifier);
     }
     return $queryPart;
 }
开发者ID:ntulip,项目名称:joobsbox-php,代码行数:14,代码来源:Query.php

示例2: generateUniqueRelationForeignKeyName

 /**
  * Get/generate a unique foreign key name for a relationship
  *
  * @param  Doctrine_Relation $relation  Relation object to generate the foreign key name for
  * @return string $fkName
  */
 public function generateUniqueRelationForeignKeyName(Doctrine_Relation $relation)
 {
     $parts = array($relation['localTable']->getTableName(), $relation->getLocalColumnName(), $relation['table']->getTableName(), $relation->getForeignColumnName());
     $key = implode('_', array_merge($parts, array($relation['onDelete']), array($relation['onUpdate'])));
     $format = $this->getAttribute(Doctrine_Core::ATTR_FKNAME_FORMAT);
     return $this->_generateUniqueName('foreign_keys', $parts, $key, $format, $this->getAttribute(Doctrine_Core::ATTR_MAX_IDENTIFIER_LENGTH));
 }
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:13,代码来源:Connection.php

示例3: setReference

 /**
  * Sets a reference pointer
  *
  * @return void
  */
 public function setReference(Doctrine_Record $record, Doctrine_Relation $relation)
 {
     $this->reference = $record;
     $this->relation = $relation;
     if ($relation instanceof Doctrine_Relation_ForeignKey || $relation instanceof Doctrine_Relation_LocalKey) {
         $this->referenceField = $relation->getForeignFieldName();
         $value = $record->get($relation->getLocalFieldName());
         foreach ($this->data as $record) {
             if ($value !== null) {
                 $record->set($this->referenceField, $value, false);
             } else {
                 $record->set($this->referenceField, $this->reference, false);
             }
         }
     } elseif ($relation instanceof Doctrine_Relation_Association) {
     }
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:22,代码来源:Collection.php

示例4: embeddedFormObjectFactory

 /**
  * Returns Doctrine Record object prepared for form given the relation
  * @param string $relationName
  * @param Doctrine_Relation $relation
  * @return Doctrine_Record
  */
 private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation)
 {
     if (!$relation->isOneToOne()) {
         $newFormObjectClass = $relation->getClass();
         $newFormObject = new $newFormObjectClass();
         $newFormObject[$this->getRelationAliasByObject($newFormObject)] = $this->getObject();
     } else {
         $newFormObject = $this->getObject()->{$relationName};
     }
     return $newFormObject;
 }
开发者ID:rschumacher,项目名称:ahDoctrineEasyEmbeddedRelationsPlugin,代码行数:17,代码来源:ahBaseFormDoctrine.class.php

示例5: generateUniqueRelationForeignKeyName

 /**
  * Get/generate a unique foreign key name for a relationship
  *
  * @param  Doctrine_Relation $relation  Relation object to generate the foreign key name for
  * @return string $fkName
  */
 public function generateUniqueRelationForeignKeyName(Doctrine_Relation $relation)
 {
     $parts = array($relation['localTable']->getTableName(), $relation->getLocalColumnName(), $relation['table']->getTableName(), $relation->getForeignColumnName());
     $key = implode('_', array_merge($parts, array($relation['onDelete']), array($relation['onUpdate'])));
     $format = $this->getAttribute(Doctrine::ATTR_FKNAME_FORMAT);
     return $this->_generateUniqueName('foreign_keys', $parts, $key, $format, $this->properties['max_identifier_length']);
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:13,代码来源:Connection.php

示例6: renderRelatedRecord

 protected function renderRelatedRecord(Doctrine_Record $record, Doctrine_Relation $relation)
 {
     $value = $record->get($relation->getLocal());
     $cacheKey = md5(implode('|', array($this->versionModel, $relation->getClass(), $value)));
     if (isset($this->relatedRecordCache[$cacheKey])) {
         return $this->relatedRecordCache[$cacheKey];
     }
     try {
         if ('DmMedia' === $relation->getClass()) {
             $relatedRecord = $relation->getTable()->findOneByIdWithFolder($value);
             if ($relatedRecord && $relatedRecord->isImage()) {
                 $return = $this->helper->media($relatedRecord)->size($this->getOption('media_width'), $this->getOption('media_height'))->render();
             } else {
                 $return = $relatedRecord;
             }
         } else {
             $return = $relation->getTable()->findOneById($value);
         }
     } catch (Exception $e) {
         $return = get_class($relation->getClass()) . ' #' . $value;
     }
     return $this->relatedRecordCache[$cacheKey] = $return;
 }
开发者ID:theolymp,项目名称:diem,代码行数:23,代码来源:dmRecordTextDiff.php

示例7: _createElementForRelation

 protected function _createElementForRelation($relationName, Doctrine_Relation $relation)
 {
     switch ($relation->getType()) {
         case Doctrine_Relation::ONE:
             return new Zend_Form_Element_Select($relationName);
         case Doctrine_Relation::MANY:
             return new Zend_Form_Element_Multiselect($relationName);
         default:
             throw new ZendX_Form_Doctrine_Exception('Relation type not supported ("' . $relation->getType() . '"). ' . 'Consider extending ' . __CLASS__ . ' and overriding ' . __METHOD__ . '() to support it.');
     }
 }
开发者ID:vladev,项目名称:zend-form-doctrine,代码行数:11,代码来源:Doctrine.php


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