/** * Implement magic method __toString() * * This method can be handily used for debugging purpose. * Simply use "echo" to dump the object's info. * * @return string */ public function __toString() { // indentation $indent = ' '; // the output string $s = ''; // class for the object $s .= 'object (' . $this->epGetClassMap()->getName() . ')' . "\n"; // object id $s .= $indent . 'oid : ' . $this->epGetObjectId() . "\n"; // object uid $s .= $indent . 'uid : ' . $this->epGetUId() . "\n"; // dirty flag $s .= $indent . 'is dirty? : '; if ($this->epIsDirty()) { $s .= 'yes'; } else { $s .= 'no'; } $s .= "\n"; // dirty flag $s .= $indent . 'is committable? : '; if ($this->epIsCommittable()) { $s .= 'yes'; } else { $s .= 'no'; } $s .= "\n"; // delete flag $s .= $indent . 'is deleted? : '; if ($this->epIsDeleted()) { $s .= 'yes'; } else { $s .= 'no'; } $s .= "\n"; // vars $vars = $this->epGetVars(); // go through each var from the example object $s .= $indent . 'vars' . "\n"; $indent .= $indent; foreach ($vars as $var => $value) { // skip oid if ($var == 'oid') { continue; } // output var name $s .= $indent . '[' . $var . ']: '; // re-get value so objects are loaded $value = $this->epGet($var); if ($value instanceof epObject) { $s .= $this->ep_m->encodeUoid($value); } else { if ($value instanceof epArray) { $s .= $value->getClass() . '(' . $value->count() . ')'; } else { $s .= print_r($value, true); } } $s .= "\n"; } // return the string return $s; }