Object Persistence in PHP?
Just wondering about this (there is probably a not too difficult answer to this, but I can't seem to find the answer online :()
How do you keep an object across multiple pages? Say you have a class called Users that pretty much models everything about a user (user name, user id, age, location, user type etc etc.) and you query the database based on the user's login to form the object then store the user_id as a session information. The user clicks on the send a message link, and you'll have to read the user_id for the session and query the database again.
Is there a better way of doing this, or is my concept totally wrong to begin with?
What about real object persistence?
I wonder if real object persistence in PHP is possible (?) Is there any extension that would provide this functionality?
By real I mean that you save object as it is (no serialization) and take it in next page load.. literally you keep object from being gone from memory when script finishes it's execution.
I don't know well php internals - I'm not sure would it be technically possible.. (if not - why?)
I have problem.. as I want to cache object which is an instance of class that is extension of php internal class - thus it cannot be serialized - heck I'm unable to cache it
..at least i need to write my own serialize method for this case and that won't be very efficient.