Session: objects containing objects

From: Date: Thu, 24 Feb 2000 09:18:56 +0000
Subject: Session: objects containing objects
Groups: php.version4 
Request: Send a blank email to php-version4+get-10803@lists.php.net to get a copy of this message
Hi, will an object containing other object be correctly stored in a session? To implement this on the user side - e.g. in PHPLIB - you'd need some very few functions for introspection: - getFields|Slots ( object $obj ) returns all fields of an object - getFieldtype|Slottype ( field $field ) analogous to getType() - getConstructorCall ( object $obj ) returns the constructor parameters used to construct the current object. This could be emulated by telling each class that wants to be serialized it has to save the contruction call in a certain slot such as phplib does with the slots that are requestet to be serialized ( $persistent_slot = array() ) . - getChildren ( object $obj ) return array of children of the current object. This could be emulated with getFields()/getFieldtype() calls, but... I know in PHP3 I can tread an object as an array which gives me a way to live without the above basic functions for introspection, but it's not warrantied that an object can always be treaded like an array, right? Please don't tell me the OO features of PHP are limited by design. Is it really that difficult to implement the for the purpose of serialization most important function getFields()? By the way Java is able to serialize object containing objects... Ulf

« previous php.version4 (#10803) next »