コード例 #1
0
 /**
  * Deletes a given record from the backend, updates the soa serial number, and
  * creates a history entry for the record
  *
  * @param PowerDnsObjectInterface $obj
  * @param bool $force
  * @return mixed
  */
 public function delete(PowerDnsObjectInterface $obj, $force = false)
 {
     /**
      * @type Records $obj
      */
     $domain = $obj->getDomain();
     if ($obj->getType() != 'SOA') {
         $this->createHistory($obj, 'DELETE');
     }
     parent::delete($obj);
     if ($obj->getType() != 'SOA') {
         $this->updateSoa($domain);
     }
     return true;
 }
コード例 #2
0
 /**
  * Updates the object in the backend
  *
  * @param PowerDnsObjectInterface $obj
  * @param array $options
  * @param bool $force
  * @throws Exceptions\ValidationException
  * @return mixed
  */
 public function update(PowerDnsObjectInterface $obj, array $options = array(), $force = false)
 {
     $loose = $obj->looseCheck();
     $groups = $loose ? ['loose'] : null;
     /**
      * @type Validator $validator
      */
     $validator = $this->getContainer()->get('validator');
     $errors = $validator->validate($obj, $groups);
     if (0 != count($errors)) {
         if (!$force) {
             throw new ValidationException('Cannot create object not valid', $errors);
         }
         $this->setWarnings($errors);
     }
     $this->getDatabase()->persist($obj);
     $this->getDatabase()->flush();
     return $obj;
 }