firstname = $firstname; $this->lastname = $lastname; } /** * @PreSerialize */ private function prepareForSerialization() { $this->name = $this->firstname.' '.$this->lastname; } /** * @PostSerialize */ private function cleanUpAfterSerialization() { $this->name = null; } /** * @PostDeserialize */ private function afterDeserialization() { list($this->firstname, $this->lastname) = explode(' ', $this->name); } /** * @PreDeserialize */ private function beforeDeserialization() { $this->preDeserializeCalled = true; } }