/** * It returns whole node from $this->node and $this->numbered. * @param bool If True is passed it checks whether all registered columns are included. * @param bool If True is passed it checks whether all columns in $this->node are registered / known. * @return array * @throws SakuraNotSupportedException * @throws SakuraBadColumnException */ public function getNode($containsAll = False, $noUnknown = False) { if (!isset($this->node)) { throw new \Sakura\SakuraNotSupportedException('The $this->node property is not set.'); } if (!is_array($this->node) and !$this->node instanceof Row) { SakuraNotSupportedException('Type of $this->node is not supported, instance of : ' . get_class($this->node) . '; type: ' . gettype($this->node) . '.'); } if ($containsAll) { $allColumns = $this->table->getAllColumns(); foreach ($this->node as $column => $v) { foreach ($allColumns as $key => $required) { if ($column == $required) { unset($allColumns[$key]); break; } } } if ($allColumns) { throw new \Sakura\SakuraBadColumnException('Columns not found!', 0, '', $allColumns, 'notfound'); } } if ($noUnknown) { $unknownColumns = array(); foreach ($this->node as $column => $v) { if (!in_array($column, $this->table->getAllColumns())) { $unknownColumns[] = $column; } } if ($unknownColumns) { throw new \Sakura\SakuraBadColumnException('There are unknown columns for Table instance!', 0, '', $unknownColumns, 'unknown'); } } if ($this->node instanceof Row) { return $this->node->toArray(); } return $this->node; }