/** * Interal mechanism to remove Actions from Module * * @param Module $model * @param mixed $data */ protected function doRemoveActions(Module $model, $data) { $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Action'; } else { $related = ActionQuery::create()->findOneById($entry['id']); $model->removeAction($related); } } if (count($errors) > 0) { return new ErrorsException($errors); } }
/** * 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->aModule) { $this->aModule->removeAction($this); } $this->id = null; $this->name = null; $this->title = null; $this->description = null; $this->class_name = null; $this->module_id = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }