/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aApplication) { $this->aApplication->removeApplicationUri($this); } if (null !== $this->aLocalization) { $this->aLocalization->removeApplicationUri($this); } $this->id = null; $this->httphost = null; $this->basepath = null; $this->secure = null; $this->application_id = null; $this->localization_id = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
/** * Interal mechanism to remove ApplicationUris from Localization * * @param Localization $model * @param mixed $data */ protected function doRemoveApplicationUris(Localization $model, $data) { $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for ApplicationUri'; } else { $related = ApplicationUriQuery::create()->findOneById($entry['id']); $model->removeApplicationUri($related); } } if (count($errors) > 0) { return new ErrorsException($errors); } }