本文整理汇总了PHP中CActiveRecord::relations方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::relations方法的具体用法?PHP CActiveRecord::relations怎么用?PHP CActiveRecord::relations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecord
的用法示例。
在下文中一共展示了CActiveRecord::relations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: relations
/**
* Returns the relations used for the model
*
* @return array
* @see YdDressing::modelMap
*/
public function relations()
{
if (!empty(Yii::app()->dressing->modelMap[get_class($this)]['relations'])) {
return Yii::app()->dressing->modelMap[get_class($this)]['relations'];
}
return parent::relations();
}
示例2: Model2ArrayRec
/**
* @param CActiveRecord $model
* */
private static function Model2ArrayRec($model)
{
$data = $model->attributes;
//Levantando relacionamentos
$rels = $model->relations();
foreach ($rels as $relation => $params) {
//Irá gerar um vetor com todos os relacionamentos
if ($model->hasRelated($relation)) {
$data[$relation] = self::relations2Array($model, $relation);
}
}
return $data;
}
示例3: processModel
/**
* Recursive function that deletes all children models to the $model.
*
* @param CActiveRecord $model the model to process.
* @param boolean $delete whether to delete the $model (the top model's deletion is handled by beforeDelete).
*/
protected function processModel($model, $delete = true)
{
foreach ($model->relations() as $relationName => $relation) {
$type = $relation[0];
$className = $relation[1];
$foreignKey = $relation[2];
if ($type == CActiveRecord::HAS_MANY) {
foreach ($model->{$relationName} as $subModel) {
if (!empty($subModel)) {
$this->processModel($subModel);
}
}
} elseif ($type == CActiveRecord::HAS_ONE) {
if (!empty($model->{$relationName})) {
$this->processModel($model->{$relationName});
}
}
}
if ($delete) {
$model->delete();
}
}
示例4: relations
public function relations()
{
return array_merge(parent::relations(), array('fiitFinv' => array(self::BELONGS_TO, 'FinvInvoice', 'fiit_finv_id'), 'fiitFprc' => array(self::BELONGS_TO, 'FprcProductCategory', 'fiit_fprc_id'), 'fiitFqnt' => array(self::BELONGS_TO, 'FqntQuantity', 'fiit_fqnt_id'), 'fiitFvat' => array(self::BELONGS_TO, 'FvatVat', 'fiit_fvat_id'), 'fixrFiitXRefs' => array(self::HAS_MANY, 'FixrFiitXRef', 'fixr_fiit_id')));
}
示例5: relations
public function relations()
{
return array_merge(parent::relations(), array('tsthTstt' => array(self::BELONGS_TO, 'TsttStatus', 'tsth_tstt_id'), 'tsthPprs' => array(self::BELONGS_TO, 'PprsPerson', 'tsth_pprs_id'), 'tsthTtsk' => array(self::BELONGS_TO, 'TtskTask', 'tsth_ttsk_id')));
}
示例6: relations
public function relations()
{
return array_merge(parent::relations(), array('ccdpCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'ccdp_ccmp_id')));
}
示例7: relations
public function relations()
{
return array_merge(parent::relations(), array('vtlsTrailerServices' => array(self::HAS_MANY, 'VtlsTrailerService', 'vtls_vtrl_id'), 'vtrdTrailerDocs' => array(self::HAS_MANY, 'VtrdTrailerDoc', 'vtrd_vtrl_id'), 'vtrlVtrt' => array(self::BELONGS_TO, 'VtrtTrailerType', 'vtrl_vtrt_id'), 'vtrlCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'vtrl_ccmp_id'), 'vvoyVoyages' => array(self::HAS_MANY, 'VvoyVoyage', 'vvoy_vtrl_id')));
}
示例8: relations
public function relations()
{
return array_merge(parent::relations(), array('tcmnCommunications' => array(self::HAS_MANY, 'TcmnCommunication', 'tcmn_tmed_id')));
}
示例9: relations
/**
* Returns the relations used for the model
* @return array
* @see AccountModule::modelMap
*/
public function relations()
{
/** @var AccountModule $account */
$account = Yii::app()->getModule('account');
if (!empty($account->modelMap[get_class($this)]['relations'])) {
return $account->modelMap[get_class($this)]['relations'];
}
return parent::relations();
}
示例10: relations
public function relations()
{
return array_merge(parent::relations(), array('fddaDimDatas' => array(self::HAS_MANY, 'FddaDimData', 'fdda_fdm2_id'), 'fddpDimDataPeriods' => array(self::HAS_MANY, 'FddpDimDataPeriod', 'fddp_fdm2_id'), 'fdm2Fret' => array(self::BELONGS_TO, 'FretRefType', 'fdm2_fret_id'), 'fdm2Fdm1' => array(self::BELONGS_TO, 'Fdm1Dimension1', 'fdm2_fdm1_id'), 'fdm3Dimension3s' => array(self::HAS_MANY, 'Fdm3Dimension3', 'fdm3_fdm2_id'), 'fdspDimensionSplits' => array(self::HAS_MANY, 'FdspDimensionSplit', 'fdsp_fdm2_id'), 'vdimDimensions' => array(self::HAS_MANY, 'VdimDimension', 'vdim_fdm2_id'), 'vpdmPlaningDimensions' => array(self::HAS_MANY, 'VpdmPlaningDimension', 'vpdm_fdm2_id')));
}
示例11: relations
public function relations()
{
return array_merge(parent::relations(), array('authassignments' => array(self::HAS_MANY, 'Authassignment', 'itemname'), 'authitemchildren' => array(self::HAS_MANY, 'Authitemchild', 'child'), 'authitemchildren1' => array(self::HAS_MANY, 'Authitemchild', 'parent'), 'rights' => array(self::HAS_MANY, 'Rights', 'itemname'), 'stfaFlowAccesses' => array(self::HAS_MANY, 'StfaFlowAccess', 'stfa_authitem')));
}
示例12: relations
/**
* Returns the relations used for the model
*
* @return array
* @see AuditModule::modelMap
*/
public function relations()
{
$audit = Yii::app()->getModule('audit');
if (!empty($audit->modelMap[get_class($this)]['relations'])) {
return $audit->modelMap[get_class($this)]['relations'];
}
return parent::relations();
}
示例13: relations
/**
* Returns the relations used for the model
*
* @return array
* @see MenuModule::modelMap
*/
public function relations()
{
$menu = Yii::app()->getModule('menu');
if (!empty($menu->modelMap[get_class($this)]['relations'])) {
return $menu->modelMap[get_class($this)]['relations'];
}
return parent::relations();
}
示例14: relations
public function relations()
{
return array_merge(parent::relations(), array('fpeoPeriodOdos' => array(self::HAS_MANY, 'FpeoPeriodOdo', 'fpeo_vodo_id'), 'vodoVtrc' => array(self::BELONGS_TO, 'VtrcTruck', 'vodo_vtrc_id')));
}
示例15: relations
public function relations()
{
return array_merge(parent::relations(), array('variants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'order' => 'variants.title'), 'activeVariants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'order' => 'activeVariants.title', 'scopes' => 'active'), 'existingVariants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'join' => 'LEFT JOIN {{eav_attribute_value}} `av` ON `existingVariants`.`id` = `av`.`variant_value`', 'condition' => '`av`.`variant_value` IS NOT NULL', 'order' => '`existingVariants`.`title`', 'scopes' => 'active'), 'variantsCount' => array(self::STAT, 'EavVariant', 'attribute_id')));
}