When you serialize() an object in PHP, it only stores the properties, 
not the methods.  This way you can change any of the methods in your 
class definitions, or add new properties, and when the data is 
unserialize()d, it will fit into the new class definition.

The latest (development) version of Pecos 
(http://pecos.screwdriver.net/) (which should, incidentally, be released 
later today or tomorrow) has moved from using entirely serialized() data 
to having a seperate table for storing properties.  Basically, we loop 
through the object using get_object_vars() and store each property 
(serialized() only if it was an array or another object) seperately in a 
seperate field.  This approach allows you to search by property rather 
than having to do a full-text search of the serialize()d data (or even 
worse, loading up each object and searching through it manually).


On Monday, July 9, 2001, at 10:58 AM, Michael Champagne wrote:

> We are writing a series of applications which will store a user 
> 'profile'
> between sessions as a serialized object in our Oracle database.  We're 
> storing
> data like the output format a user prefers file downloads in and things 
> like
> that.  If have to add certain things to this class, I'm assuming the
> serialized objects in the database become unusable.  Does anyone have a 
> good
> solution for this?  I suppose we could go through the database and 
> somehow
> convert these serialized 'profiles' to meet the new class spec.  How 
> much of a
> hassle is that?
> Thanks in advance for any responses,
> Michael Champagne, Software Engineer
> Capital Institutional Services, Inc.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to