Modifying php template to not unnecessarily re-deserialize