/** * Transforms the soa record to a string and sets the modification date * and the changedate */ public function preUpdate(Records $record, PreUpdateEventArgs $event) { $record->setModified(new \DateTime()); $record->setChangeDate(strtotime('now')); if ($record->getType() == 'SOA') { $transformer = new SoaTransformer(); $record->setContent($transformer->reverseTransform($record->getContent()), true); } }
public function loadFooBar_de(ObjectManager $manager) { /** * @type RecordWorkflow $recordWorkflow */ $recordWorkflow = $this->container->get('syseleven.pdns.workflow.records'); $domainObj = new Domains(); $domainObj->setName('foobar.de'); $domainObj->setType('NATIVE'); $manager->persist($domainObj); $manager->flush(); $soa = new Records(); $soa->setName('foobar.de'); $soa->setType('SOA'); $soa->setContent(' 1375872531 10800 604800 3600 '); $soa->setTtl(3600); $soa->setChangeDate(strtotime('now')); $soa->setManaged(1); $soa->setDomain($domainObj); $recordWorkflow->create($soa); $domainObj->addRecord($soa); $recordWorkflow->createHistory($soa, 'CREATE'); $ns1 = new Records(); $ns1->setName('foobar.de'); $ns1->setContent('ns1.ns.de'); $ns1->setPrio(10); $ns1->setTtl(3600); $ns1->setType('NS'); $ns1->setDomain($domainObj); $recordWorkflow->create($ns1); $ns2 = new Records(); $ns2->setName('foobar.de'); $ns2->setContent('ns2.ns.de'); $ns2->setPrio(20); $ns2->setTtl(3600); $ns2->setType('NS'); $ns2->setDomain($domainObj); $recordWorkflow->create($ns2); $mx = new Records(); $mx->setName('foobar.de'); $mx->setContent('mail.foobar.de'); $mx->setPrio(20); $mx->setTtl(3600); $mx->setType('MX'); $mx->setDomain($domainObj); $recordWorkflow->create($mx); $www = new Records(); $www->setName('www.foobar.de'); $www->setType('A'); $www->setContent('2.1.1.1'); $www->setDomain($domainObj); $recordWorkflow->create($www); $www = new Records(); $www->setName('www2.foobar.de'); $www->setType('CNAME'); $www->setContent('www.foobar.de'); $www->setDomain($domainObj); $recordWorkflow->create($www); }