public function generateDBUpdateForInstallation() { $tpl = new ilTemplate(dirname(__FILE__) . '/templates/dbupdate.txt', true, true); $ar = $this->getAr(); $tpl->setVariable('TABLE_NAME', $ar->getConnectorContainerName()); $tpl->setVariable('TABLE_NAME2', $ar->getConnectorContainerName()); $tpl->setVariable('TABLE_NAME3', $ar->getConnectorContainerName()); $tpl->setVariable('STEP', $this->getStep()); $tpl->setVariable('PRIMARY', $this->getAr()->getArFieldList()->getPrimaryFieldName()); foreach ($this->getAr()->getArFieldList()->getFields() as $field) { $tpl->touchBlock('field'); $tpl->setVariable('FIELD_NAME', $field->getName()); foreach ($field->getAttributesForConnector() as $name => $value) { $tpl->setCurrentBlock('attribute'); $tpl->setVariable('NAME', arFieldList::mapKey($name)); $tpl->setVariable('VALUE', $value); $tpl->parseCurrentBlock(); } } if ($this->getAr()->getArFieldList()->getPrimaryField()->getFieldType() == arField::FIELD_TYPE_INTEGER) { $tpl->setCurrentBlock('attribute'); $tpl->setVariable('TABLE_NAME4', $ar->getConnectorContainerName()); $tpl->parseCurrentBlock(); } header('Content-type: application/x-httpd-php'); header("Content-Disposition: attachment; filename=\"dbupdate.php\""); echo $tpl->get(); exit; }
/** * @return array */ public function getAttributesForDescription() { $return = array(); foreach (arFieldList::getAllowedDescriptionFields() as $field_name) { if ($this->{$field_name} and self::isAllowedAttribute($this->getFieldType(), $field_name)) { $return[arFieldList::mapKey($field_name)] = $this->{$field_name}; } } return $return; }
/** * @return bool */ protected final function installDatabase() { if (!$this->tableExists()) { $fields = array(); foreach ($this->arFieldList->getFields() as $field) { $fields[$field->getName()] = $field->getAttributesForConnector(); } return $this->arConnector->installDatabase($this, $fields); } else { return $this->arConnector->updateDatabase($this); } }
/** * @param $storage_class_name * @param \ActiveRecord|\arStorageInterface $foreign_model * * @internal param \ActiveRecord $storage * @internal param $storage_class_name */ public static function storeFromStorage($storage_class_name, arStorageInterface $foreign_model) { self::$cache[$storage_class_name] = arFieldList::getInstanceFromStorage($foreign_model); }