public function addToListArrayRow($action, &$arr, $nr, $fieldprefix, $flags, $edit = false, DataGrid $grid = null, $column = '*') { if ($this->hasFlag(self::AF_HIDE_LIST) || !$this->createDestination()) { return; } if (!$this->hasFlag(self::AF_ONETOONE_INTEGRATE) && $column == '*' || $column == null) { parent::addToListArrayRow($action, $arr, $nr, $fieldprefix, $flags, $edit, $grid, $column); return; } else { if (!$this->hasFlag(self::AF_ONETOONE_INTEGRATE) || $column != '*' && $this->getDestination()->getAttribute($column) == null) { throw new \Exception("Invalid list column {$column} for atkOneToOneRelation " . $this->getOwnerInstance()->atkNodeUri() . '::' . $this->fieldName()); } } // integrated version, don't add ourselves, but add all columns from the destination // small trick, the destination record is in a subarray. The destination // addToListArrayRow will not expect this though, so we have to modify the // record a bit before passing it to the detail columns. $oldrecord = $arr['rows'][$nr]['record']; $arr['rows'][$nr]['record'] = $arr['rows'][$nr]['record'][$this->fieldName()]; $prefix = $fieldprefix . $this->fieldName() . '_AE_'; foreach (array_keys($this->m_destInstance->m_attribList) as $attribname) { if ($column != '*' && $column != $attribname) { continue; } $p_attrib = $this->m_destInstance->getAttribute($attribname); $p_attrib->addToListArrayRow($action, $arr, $nr, $prefix, $flags, $edit, $grid, null); } $arr['rows'][$nr]['record'] = $oldrecord; }
public function addToListArrayRow($action, &$arr, $nr, $fieldprefix, $flags, $edit = false, DataGrid $grid = null, $column = '*') { if ($column == null || $column == '*') { $prefix = $fieldprefix . $this->fieldName() . '_AE_'; parent::addToListArrayRow($action, $arr, $nr, $prefix, $flags, $edit, $grid, null); } if ($column == '*') { // only add extra columns when needed if ($this->hasFlag(self::AF_HIDE_LIST) && !$this->m_alwaysShowListColumns) { return; } if (!$this->createDestination() || count($this->m_listColumns) == 0) { return; } foreach ($this->m_listColumns as $column) { $this->_addColumnToListArrayRow($column, $action, $arr, $nr, $fieldprefix, $flags, $edit, $grid); } } else { if ($column != null) { $this->_addColumnToListArrayRow($column, $action, $arr, $nr, $fieldprefix, $flags, $edit, $grid); } } }