本文整理汇总了PHP中Doctrine_Relation::getLocal方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Relation::getLocal方法的具体用法?PHP Doctrine_Relation::getLocal怎么用?PHP Doctrine_Relation::getLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Relation
的用法示例。
在下文中一共展示了Doctrine_Relation::getLocal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setReference
/**
* 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->getForeign();
$value = $record->get($relation->getLocal());
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) {
}
}
示例2: 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->getForeign());
if ($relation->isEqual()) {
$queryPart .= ' OR ' . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) . ' = ' . $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal()) . ') AND ' . $this->_conn->quoteIdentifier($foreignAlias . '.' . $localIdentifier) . ' != ' . $this->_conn->quoteIdentifier($localAlias . '.' . $localIdentifier);
}
return $queryPart;
}
示例3: 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;
}