コード例 #1
0
 public function getLabel()
 {
     if (!isset($this->relatedModel)) {
         return null;
     }
     return $this->relatedModel->getRelationshipLabel($this->myModel->id, get_class($this->myModel));
 }
コード例 #2
0
 /**
  * Set attributes with attributes of embedded model or values specified in GET params
  */
 public function init()
 {
     $scenario = $this->getScenario();
     if ($scenario === 'search' && isset($_GET[get_called_class()])) {
         $this->setAttributes($_GET[get_called_class()], false);
     } elseif ($this->relatedModel) {
         $this->setAttributes($this->relatedModel->getAttributes(), false);
         $this->label = $this->relatedModel->getRelationshipLabel($this->myModel);
     }
 }