public function addMormFromArray($table, $to_load, &$to_associate = null) { $model_name = get_class($this->base_models[$this->base_table]); $model = Morm::FactoryFromMormons($model_name, $this, $to_load); $model_fields = $model->getTableDesc(); if ($model_fields->getPKey()) { $this->mormons[$this->base_table . '_' . $model->{$model->_pkey}] = $model; } else { $this->mormons[] = $model; } if (is_object($to_associate)) { $model->loadForeignObject($to_associate->_pkey, $to_associate); } $this->mormon_keys = array_keys($this->mormons); $this->nb_mormons = count($this->mormons); }
public function delete() { $position = $this->position; if (parent::delete()) { $sql = "update `" . $this->_table . "` set position = position - 1 where position > " . $position; if (SqlTools::sqlQuery($sql)) { return true; } return false; } }