public function attach($owner) { if ($this->attribute === null || $this->relationName === null || $this->relationType === null || $this->relationAttribute === null || $this->relationTable === null) { throw new CException(Yii::t('Contact.main', 'You must set $attribute, $relationName, $relationType, $relationAttribute, $relationTable.')); } $owner->getMetadata()->addRelation($this->relationName, [$this->relationType, $this->className, "{$this->relationTable}({$this->relationAttribute},{$this->attribute})", 'order' => $this->relationName . '.weight DESC']); parent::attach($owner); }
public function attach($owner) { if ($this->attribute === null || $this->relationName === null || $this->relationType === null) { throw new CException(Yii::t('Contact.main', 'You must set $attribute, $relationName, $relationType.')); } $owner->getMetadata()->addRelation($this->relationName, [$this->relationType, $this->className, $this->attribute]); parent::attach($owner); }