Opens and saves an objct using the PHP serialize/deserialize function.
The property persistance is the absolute file path.
save() saves the file.
open() reads the file.
Serialize is used by swRecord to save the object to the current folder.
Serialize and deserialize are very handy, because they allow to save and open the object in one line and work with all types of properties, even with references. They can also easily be used to assign the object to a local variable inside a function. They are faster than reading and parsing the original revision.
They have however also limits, that is why we do not use it for the indexes:
- They get slow reading large arrays and incremental writing is not possible
- They may save down temporal properties you would not want at a later moment. Therefore, on editing, we always read the original revision.