Re: DB_DataObject and XML_Serializer Private Variables

From: Date: Mon, 11 Jul 2005 16:05:34 +0000
Subject: Re: DB_DataObject and XML_Serializer Private Variables
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19939@lists.php.net to get a copy of this message
On 7/10/05, Daniel Curran <codetown@gmail.com> wrote: > I have a data object and I want to serialize this object. When I > preform the serialization I am getting a bunch of data pre-pended that > I do not want. > > This data is: > > <_DB_DataObject_version>1.7.13</_DB_DataObject_version> > <__table>table</__table> > <N>2</N> > <_database_dsn/> > <_database_dsn_md5>678920bcaf47327fb936d911d8f42e7cd</_database_dsn_md5> > <_database>database</_database> > <_DB_resultid>1</_DB_resultid> > <_link_loaded/> > <_join/> > <_lastError/> > > All of these values are (should be) private. I am looking for a > solution that is not an ugly hack to remove these items from the > output. Well, XML_Serializer is serializing all of the data in the object. This is as expected, I think. > > I am not really sure if there is a function for the DB_DataObject that > would return a cloned instance of the data without the private > variables. Or if there is a method in XML_Serializer that would allow > me to exclude certain data values from the serialized output. I have > looked into the code and I have not seen anything like what I am > looking for, but I could have missed it. > > The solution that I have for this would be to post-process the > information from the data-object before having it serialized, but this > seems really ugly to me, and I feel that it should be something that > would be handled in both of these packages. > > Any recommendations? > Perhaps try using the DataObject's toArray() function? -- Justin Patrin

« previous php.pear.general (#19939) next »