/** * 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; }