diff --git a/application/Espo/Core/Utils/Database/Orm/Converter.php b/application/Espo/Core/Utils/Database/Orm/Converter.php index 191d19e510..c160a3cb24 100644 --- a/application/Espo/Core/Utils/Database/Orm/Converter.php +++ b/application/Espo/Core/Utils/Database/Orm/Converter.php @@ -1,4 +1,4 @@ - ORM */ protected $fieldAccordances = array( 'type' => 'type', 'dbType' => 'dbType', 'maxLength' => 'len', 'len' => 'len', - 'notnull' => 'notnull', + 'notNull' => 'notNull', 'autoincrement' => 'autoincrement', 'notStorable' => 'notStorable', 'link' => 'relation', @@ -60,7 +60,7 @@ class Converter 'unique' => 'unique', 'index' => 'index', /*'conditions' => 'conditions', - 'additionalColumns' => 'additionalColumns', */ + 'additionalColumns' => 'additionalColumns', */ 'default' => array( 'condition' => '^javascript:', 'conditionEquals' => false, @@ -199,7 +199,7 @@ class Converter case 'foreignId': $fieldParams = array_merge($fieldParams, $this->idParams); - $fieldParams['notnull'] = false; + $fieldParams['notNull'] = false; break; case 'foreignType': @@ -304,12 +304,12 @@ class Converter $fieldParams = Util::merge($fieldParams, $fieldTypeMeta['database']); } - //if defined 'notnull => false' and 'required => true', then remove 'notnull' - if (isset($fieldParams['notnull']) && !$fieldParams['notnull'] && isset($fieldParams['required']) && $fieldParams['required']) { - unset($fieldParams['notnull']); - } //END + //if defined 'notNull => false' and 'required => true', then remove 'notNull' + if (isset($fieldParams['notNull']) && !$fieldParams['notNull'] && isset($fieldParams['required']) && $fieldParams['required']) { + unset($fieldParams['notNull']); + } //END + - $fieldDefs = $this->getInitValues($fieldParams); //check if field need to be saved in database @@ -448,23 +448,23 @@ class Converter protected function getInitValues(array $fieldParams) { $values = array(); - foreach($this->fieldAccordances as $espoType => $doctrineType) { + foreach($this->fieldAccordances as $espoType => $ormType) { if (isset($fieldParams[$espoType])) { - if (is_array($doctrineType)) { + if (is_array($ormType)) { $conditionRes = false; if (!is_array($fieldParams[$espoType])) { - $conditionRes = preg_match('/'.$doctrineType['condition'].'/i', $fieldParams[$espoType]); + $conditionRes = preg_match('/'.$ormType['condition'].'/i', $fieldParams[$espoType]); } - if (!$conditionRes || ($conditionRes && $conditionRes === $doctrineType['conditionEquals']) ) { + if (!$conditionRes || ($conditionRes && $conditionRes === $ormType['conditionEquals']) ) { $value = is_array($fieldParams[$espoType]) ? json_encode($fieldParams[$espoType]) : $fieldParams[$espoType]; - $values = Util::merge( $values, Util::replaceInArray('{0}', $value, $doctrineType['value']) ); + $values = Util::merge( $values, Util::replaceInArray('{0}', $value, $ormType['value']) ); } } else { - $values[$doctrineType] = $fieldParams[$espoType]; + $values[$ormType] = $fieldParams[$espoType]; } } diff --git a/application/Espo/Core/Utils/Database/Orm/Fields/LinkParent.php b/application/Espo/Core/Utils/Database/Orm/Fields/LinkParent.php index 2809b6e9be..6e7b779056 100644 --- a/application/Espo/Core/Utils/Database/Orm/Fields/LinkParent.php +++ b/application/Espo/Core/Utils/Database/Orm/Fields/LinkParent.php @@ -1,4 +1,4 @@ - array( 'type' => 'foreignType', - 'notnull' => false, - 'index' => $field['name'], + 'notNull' => false, + 'index' => $field['name'], ), $field['name'].'Name' => array( 'type' => 'varchar', diff --git a/application/Espo/Core/Utils/Database/Schema/Converter.php b/application/Espo/Core/Utils/Database/Schema/Converter.php index 591de5c1e8..33ebed3f92 100644 --- a/application/Espo/Core/Utils/Database/Schema/Converter.php +++ b/application/Espo/Core/Utils/Database/Schema/Converter.php @@ -1,4 +1,4 @@ - doctrine protected $allowedDbFieldParams = array( 'len' => 'length', 'default' => 'default', - 'notnull' => 'notnull', + 'notNull' => 'notnull', 'autoincrement' => 'autoincrement', 'unique' => 'unique', ); @@ -87,14 +87,14 @@ class Converter $GLOBALS['log']->debug('Schema\Converter - Start: building schema'); //check if exist files in "Tables" directory and merge with ormMetadata - $ormMeta = Util::merge($ormMeta, $this->getCustomTables()); + $ormMeta = Util::merge($ormMeta, $this->getCustomTables()); //unset some keys in orm if (isset($ormMeta['unset'])) { $ormMeta = Util::unsetInArray($ormMeta, $ormMeta['unset']); unset($ormMeta['unset']); } //END: unset some keys in orm - + $schema = $this->getSchema(); @@ -115,7 +115,7 @@ class Converter switch ($fieldParams['type']) { case 'id': $primaryColumns[] = Util::toUnderScore($fieldName); - break; + break; } $fieldType = isset($fieldParams['dbType']) ? $fieldParams['dbType'] : $fieldParams['type']; @@ -130,13 +130,13 @@ class Converter } //add unique - if ($fieldParams['type']!= 'id' && isset($fieldParams['unique'])) { + if ($fieldParams['type']!= 'id' && isset($fieldParams['unique'])) { $uniqueColumns = $this->getKeyList($columnName, $fieldParams['unique'], $uniqueColumns); } //END: add unique //add index. It can be defined in entityDefs as "index" if (isset($fieldParams['index'])) { - $indexList = $this->getKeyList($columnName, $fieldParams['index'], $indexList); + $indexList = $this->getKeyList($columnName, $fieldParams['index'], $indexList); } //END: add index } @@ -150,8 +150,8 @@ class Converter if (!empty($uniqueColumns)) { foreach($uniqueColumns as $uniqueItem) { $tables[$entityName]->addUniqueIndex($uniqueItem); - } - } + } + } } //check and create columns/tables for relations @@ -171,7 +171,7 @@ class Converter if (!isset($tables[$tableName])) { //no needs to create the table if it already exists $tables[$tableName] = $this->prepareManyMany($entityName, $relationParams, $tables); } - break; + break; case 'belongsTo': $foreignEntity = $relationParams['entity']; @@ -288,8 +288,8 @@ class Converter /** * Get key list (index, unique). Ex. index => true OR index => 'somename' * @param string $columnName Column name (underscore field name) - * @param bool | string $keyValue - * @return array + * @param bool | string $keyValue + * @return array */ protected function getKeyList($columnName, $keyValue, array $keyList) { @@ -314,7 +314,7 @@ class Converter foreach($fileList as $fileName) { $fileData = $this->getFileManager()->getContents( array($this->customTablePath, $fileName) ); - if (is_array($fileData)) { + if (is_array($fileData)) { $customTables = Util::merge($customTables, $fileData); } } diff --git a/application/Espo/Resources/metadata/fields/date.json b/application/Espo/Resources/metadata/fields/date.json index bd314941d4..15bbe7e9f1 100644 --- a/application/Espo/Resources/metadata/fields/date.json +++ b/application/Espo/Resources/metadata/fields/date.json @@ -23,6 +23,6 @@ "advanced":true }, "database":{ - "notnull":false + "notNull":false } } diff --git a/application/Espo/Resources/metadata/fields/datetime.json b/application/Espo/Resources/metadata/fields/datetime.json index 2089e6d64a..a190ecee56 100644 --- a/application/Espo/Resources/metadata/fields/datetime.json +++ b/application/Espo/Resources/metadata/fields/datetime.json @@ -23,6 +23,6 @@ "advanced":false }, "database":{ - "notnull":false + "notNull":false } } diff --git a/application/Espo/Resources/metadata/fields/float.json b/application/Espo/Resources/metadata/fields/float.json index eab97a369c..3f6ac595e3 100644 --- a/application/Espo/Resources/metadata/fields/float.json +++ b/application/Espo/Resources/metadata/fields/float.json @@ -23,6 +23,6 @@ "advanced":true }, "database":{ - "notnull":false + "notNull":false } }