예제 #1
0
 protected function _getSiblingRows()
 {
     if (!isset($this->_siblingRows)) {
         $this->_siblingRows = array();
         foreach ($this->_model->getSiblingModels() as $k => $m) {
             if ($m instanceof Kwf_Model_SubModel_Interface) {
                 $r = $m->getRowBySiblingRow($this);
             } else {
                 $ref = $m->getReferenceByModelClass(get_class($this->_model), $k);
                 $r = null;
                 if ($this->{$this->_getPrimaryKey()}) {
                     $r = $m->getRow(array('equals' => array($ref['column'] => $this->{$this->_getPrimaryKey()})));
                 }
                 if (!$r) {
                     $r = $m->createRow();
                     $r->{$ref['column']} = $this->{$this->_getPrimaryKey()};
                 }
             }
             $this->_siblingRows[$k] = $r;
         }
     }
     return $this->_siblingRows;
 }