/** * Sets the current date to the object, and if the record is of type * transforms the soa object to a string */ public function prePersist(Records $record, LifecycleEventArgs $event) { $record->setCreated(new \DateTime()); $record->setModified(new \DateTime()); $record->setChangeDate(strtotime('now')); if ($record->getType() == 'SOA') { $transformer = new SoaTransformer(); $record->setContent($transformer->reverseTransform($record->getContent()), true); } }