Re: Re: Add methods to object dinamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2004-10-26 at 14:21, Francisco M. Marzoa wrote:
> Greg Beaver wrote:
> 
> > Sort of :)
> >
> > In PHP5, this will work.
> 
> [...]
> 
> Very nice, thanks a lot :-)
> 
> >
> > However, you won't have access to private or protected data members.
> 
> Damn! that's exactly what I want! :-(
> 
> > It is always better to rigidly define your methods, and extend the 
> > class as someone else suggested.
> 
> The problem is that I need to serialize some objects to put them on a 
> database, but I'll have problems when some of these objects contains 
> another ones from third parties where I do not control the inheritance 
> and I've not access directly to object fields.
> 
> Converting the object to an array is useful for serialization, as I can 
> access private and protected object member values, but I cannot 
> unserialize them because I cannot wrote those members again.
> 
> Never mind. I surely must rethink the matter again.
> 
> Thanks a million, Greg.

Could you serialize the object then parse the serialized data yourself
and manipulate the values as an array, then re-serialize back to object
form and then unserialize as an object with modified protected/private
members? Sounds like a lot of work, but it just might bypass the whole
protected/private issue :) Not that it's generally a good thing to
bypass such things *heheh*.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux