本文整理汇总了PHP中Doctrine_Relation::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Relation::getClass方法的具体用法?PHP Doctrine_Relation::getClass怎么用?PHP Doctrine_Relation::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Relation
的用法示例。
在下文中一共展示了Doctrine_Relation::getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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;
}