I have a PHP class that stores the results of a database query, but also contains a PDO object so that the results can be updated / reinserted / etc. on the fly. Temporary ORM if you want.
The problem is that I need to serialize this class, but PDO instances cannot be serialized. I'm fine with that; by the time the object is serialized, I do not need a PDO instance.
Is there a way to mark a variable to exclude from serialization inside a class, for example, with some other languages? I understand that I can manually disable () the PDO variable before I want to serialize the class, but with the current code structure this will be a bit of a nightmare.
My saving grace here will be the __serialize () method, which can be overridden, but it does not look as it is.
source
share