public function attach($owner) {
		parent::attach($owner);
		if ($this->name === null) {
			throw new InvalidConfigException("No name specified for ".get_class($this));
		}
		if (method_exists($owner, "getPrimaryKey")) {
			$this->_oldName = $this->name;

			$pk = $owner->getPrimaryKey();
			if (is_array($pk)) {
				foreach($pk as $key => $value) {
					$pk[$key] = $key.":".$value;
				}
				$pk = implode(":",$pk);
			}
			$this->name = get_class($owner).":".$pk.":".$this->name;
		}
	}
public function attach($owner) {
		parent::attach($owner);
		if ($this->name === null) {
			throw new InvalidConfigException("No name specified for ".get_class($this));
		}
		if (method_exists($owner, "getPrimaryKey")) {
			$this->_oldName = $this->name;

			$pk = $owner->getPrimaryKey();
			if (is_array($pk)) {
				foreach($pk as $key => $value) {
					$pk[$key] = $key.":".$value;
				}
				$pk = implode(":",$pk);
			}
			$this->name = get_class($owner).":".$pk.":".$this->name;
		}
	}
public function attach ( $ owner ) { parent :: attach ( $ owner ) ; if ( $ this -> name === null ) { throw new InvalidConfigException ( "No name specified for " . get_class ( $ this ) ) ; } if ( method_exists ( $ owner , "getPrimaryKey" ) ) { $ this -> _oldName = $ this -> name ; $ pk = $ owner -> getPrimaryKey ( ) ; if ( is_array ( $ pk ) ) { foreach ( $ pk as $ key => $ value ) { $ pk [ $ key ] = $ key . ":" . $ value ; } $ pk = implode ( ":" , $ pk ) ; } $ this -> name = get_class ( $ owner ) . ":" . $ pk . ":" . $ this -> name ; } }
Attaches the entity to a component
@throws InvalidConfigException if no name is set
@param \yii\base\Component $owner the owner component
Attaches the entity to a component