/** * Returns the node in an array representation that can be used for serialization * * @param bool $addChildNodes * @return array */ public function toArray($addChildNodes = TRUE) { $arrayRepresentation = array('serializeClassName' => get_class($this), 'id' => $this->id); if ($this->parentNode !== NULL) { $arrayRepresentation['parentNode'] = $this->parentNode->toArray(FALSE); } else { $arrayRepresentation['parentNode'] = ''; } if ($this->hasChildNodes() && $addChildNodes) { $arrayRepresentation['childNodes'] = $this->childNodes->toArray(); } else { $arrayRepresentation['childNodes'] = ''; } return $arrayRepresentation; }
/** * Returns the collection in an array representation for e.g. serialization * * @return array */ public function toArray() { $arrayRepresentation = parent::toArray(); unset($arrayRepresentation['serializeClassName']); return $arrayRepresentation; }