开发者

How to store Propel objects into file?

I need to have option for Propel to store the data into database and file as well. Is there any way how to do that? I'll create the objects, fill the data and then ne开发者_如何转开发ed to store them into file (session) and be able to recreate the objects later. In some time it will go to database as well. Any idea?


I assume you could always create the object, fill some fields, and then serialize the object to a string, which you can save to a file. If you then deserialize this string, you get your original object. Watch out for references to objects or resources that can't be serialized, or should be re-created on serialization.

Once you get this working in one class, you can write a behavior (in Propel 1.5) that adds it to all your model classes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜