Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 /**
  * Creates a new Soa Entry for the class
  *
  * @param Domains $domainObj
  * @return Records
  */
 public function createSoa(Domains $domainObj)
 {
     if ($soa = $domainObj->getSoa()) {
         $this->updateSoa($domainObj);
     }
     $soaDefaults = new Soa($this->getSoaDefaults());
     $soa = new Records();
     $soa->setName($domainObj->getName());
     $soa->setType('SOA');
     $soa->setContent($soaDefaults);
     $soa->setDomain($domainObj);
     $soa->setTtl($soaDefaults->getDefaultTtl());
     $this->getDatabase()->persist($soa);
     $this->getDatabase()->flush();
     $domainObj->addRecord($soa);
     return $soa;
 }