public function endEditLookup()
 {
     $this->current = Modules::getModule($this->request->current);
     $this->entity = $this->current->getEntity($this->request->entity);
     $this->lookup = ModelField::createField(ModelField::TYPE_LOOKUP, $this->request->name, $this->request->description, 0, '');
     $relation = $this->entity->relations[$this->request->relation];
     // TODO: Was machen, wenn leer
     $this->lookup->setRelation($relation);
     $this->lookup->setField($this->request->field);
     $this->entity->lookupFields[$this->request->name] = $this->lookup;
     $this->current->save();
     $this->request->clear();
     $this->request->id = $this->current->qualifiedName;
     $this->request->hash = 'entity_' . $this->entity->name;
     $this->request->initPanel = 2;
 }
 /**
  * Legt das übergebene Feld an, falls es noch nicht existiert
  * @param $feld
  */
 protected function forwardEngineerFeld(ModelField $feld)
 {
     if (!$feld->isWritable()) {
         return;
     }
     // Existiert das Feld?
     if (!Schema::fieldExists($this->name, $feld)) {
         Schema::alterTable($this->name)->addField($feld)->execute();
     }
     // Ggf. in den passenden Index prüfen
     if ($feld->getIndex() == '1' && !Schema::indexExists($this->name, $feld)) {
         Schema::createIndex($this->name)->addField($feld)->execute();
     }
 }