update 2024-04-20 20:05:37
This commit is contained in:
parent
3bdd6c6667
commit
4134cff484
@ -61,7 +61,7 @@ class Builders << (F,LightGreen) >> #RoyalBlue {
|
|||||||
# CMSApplication $app
|
# CMSApplication $app
|
||||||
+ __construct(Config $config, Power $power, ...)
|
+ __construct(Config $config, Power $power, ...)
|
||||||
+ set(string $langLabel, string $langView, ...) : void
|
+ set(string $langLabel, string $langView, ...) : void
|
||||||
- normalizeDatabaseValues(string $nameSingleCode, string $name) : ?array
|
- normalizeDatabaseValues(string $nameSingleCode, string $name, ...) : ?array
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of Builders::__construct
|
note right of Builders::__construct
|
||||||
@ -147,6 +147,12 @@ to types based on the 'length' field. It removes unnecessary fields from the res
|
|||||||
|
|
||||||
since: 3.2.1
|
since: 3.2.1
|
||||||
return: ?array
|
return: ?array
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $nameSingleCode
|
||||||
|
string $name
|
||||||
|
string $uniquekey
|
||||||
|
string $iskey
|
||||||
end note
|
end note
|
||||||
|
|
||||||
@enduml
|
@enduml
|
||||||
|
@ -693,6 +693,8 @@ final class Builders
|
|||||||
$field['settings']->null_switch);
|
$field['settings']->null_switch);
|
||||||
// set index types
|
// set index types
|
||||||
$_guid = true;
|
$_guid = true;
|
||||||
|
$databaseuniquekey = false;
|
||||||
|
$databasekey = false;
|
||||||
if ($field['settings']->indexes == 1
|
if ($field['settings']->indexes == 1
|
||||||
&& !in_array(
|
&& !in_array(
|
||||||
$field['settings']->datatype, $textKeys
|
$field['settings']->datatype, $textKeys
|
||||||
@ -700,6 +702,7 @@ final class Builders
|
|||||||
{
|
{
|
||||||
// build unique keys of this view for db
|
// build unique keys of this view for db
|
||||||
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
|
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
|
||||||
|
$databaseuniquekey = true;
|
||||||
// prevent guid from being added twice
|
// prevent guid from being added twice
|
||||||
if ('guid' === $name)
|
if ('guid' === $name)
|
||||||
{
|
{
|
||||||
@ -715,6 +718,7 @@ final class Builders
|
|||||||
{
|
{
|
||||||
// build keys of this view for db
|
// build keys of this view for db
|
||||||
$this->databasekeys->add($nameSingleCode, $name, true);
|
$this->databasekeys->add($nameSingleCode, $name, true);
|
||||||
|
$databasekey = true;
|
||||||
}
|
}
|
||||||
// special treatment for GUID
|
// special treatment for GUID
|
||||||
if ('guid' === $name && $_guid)
|
if ('guid' === $name && $_guid)
|
||||||
@ -1301,7 +1305,7 @@ final class Builders
|
|||||||
'list' => $nameListCode,
|
'list' => $nameListCode,
|
||||||
'store' => (isset($field['store'])) ? $field['store'] : null,
|
'store' => (isset($field['store'])) ? $field['store'] : null,
|
||||||
'tab_name' => $tabName,
|
'tab_name' => $tabName,
|
||||||
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name)
|
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1314,11 +1318,13 @@ final class Builders
|
|||||||
*
|
*
|
||||||
* @param string $nameSingleCode The code for naming single entries.
|
* @param string $nameSingleCode The code for naming single entries.
|
||||||
* @param string $name The name of the database entry.
|
* @param string $name The name of the database entry.
|
||||||
|
* @param string $uniquekey Is this field a uniquekey
|
||||||
|
* @param string $iskey Is this field a key
|
||||||
*
|
*
|
||||||
* @return array|null Returns the modified database values array or null if no values are found.
|
* @return array|null Returns the modified database values array or null if no values are found.
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
private function normalizeDatabaseValues($nameSingleCode, $name): ?array
|
private function normalizeDatabaseValues($nameSingleCode, $name, $uniquekey, $iskey): ?array
|
||||||
{
|
{
|
||||||
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
|
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
|
||||||
if ($db_values === null)
|
if ($db_values === null)
|
||||||
@ -1347,6 +1353,9 @@ final class Builders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db_values['unique_key'] = $uniquekey;
|
||||||
|
$db_values['key'] = $iskey;
|
||||||
|
|
||||||
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
|
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
|
||||||
|
|
||||||
return $db_values;
|
return $db_values;
|
||||||
|
@ -616,6 +616,8 @@
|
|||||||
$field['settings']->null_switch);
|
$field['settings']->null_switch);
|
||||||
// set index types
|
// set index types
|
||||||
$_guid = true;
|
$_guid = true;
|
||||||
|
$databaseuniquekey = false;
|
||||||
|
$databasekey = false;
|
||||||
if ($field['settings']->indexes == 1
|
if ($field['settings']->indexes == 1
|
||||||
&& !in_array(
|
&& !in_array(
|
||||||
$field['settings']->datatype, $textKeys
|
$field['settings']->datatype, $textKeys
|
||||||
@ -623,6 +625,7 @@
|
|||||||
{
|
{
|
||||||
// build unique keys of this view for db
|
// build unique keys of this view for db
|
||||||
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
|
$this->databaseuniquekeys->add($nameSingleCode, $name, true);
|
||||||
|
$databaseuniquekey = true;
|
||||||
// prevent guid from being added twice
|
// prevent guid from being added twice
|
||||||
if ('guid' === $name)
|
if ('guid' === $name)
|
||||||
{
|
{
|
||||||
@ -638,6 +641,7 @@
|
|||||||
{
|
{
|
||||||
// build keys of this view for db
|
// build keys of this view for db
|
||||||
$this->databasekeys->add($nameSingleCode, $name, true);
|
$this->databasekeys->add($nameSingleCode, $name, true);
|
||||||
|
$databasekey = true;
|
||||||
}
|
}
|
||||||
// special treatment for GUID
|
// special treatment for GUID
|
||||||
if ('guid' === $name && $_guid)
|
if ('guid' === $name && $_guid)
|
||||||
@ -1224,7 +1228,7 @@
|
|||||||
'list' => $nameListCode,
|
'list' => $nameListCode,
|
||||||
'store' => (isset($field['store'])) ? $field['store'] : null,
|
'store' => (isset($field['store'])) ? $field['store'] : null,
|
||||||
'tab_name' => $tabName,
|
'tab_name' => $tabName,
|
||||||
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name)
|
'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1237,11 +1241,13 @@
|
|||||||
*
|
*
|
||||||
* @param string $nameSingleCode The code for naming single entries.
|
* @param string $nameSingleCode The code for naming single entries.
|
||||||
* @param string $name The name of the database entry.
|
* @param string $name The name of the database entry.
|
||||||
|
* @param string $uniquekey Is this field a uniquekey
|
||||||
|
* @param string $iskey Is this field a key
|
||||||
*
|
*
|
||||||
* @return array|null Returns the modified database values array or null if no values are found.
|
* @return array|null Returns the modified database values array or null if no values are found.
|
||||||
* @since 3.2.1
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
private function normalizeDatabaseValues($nameSingleCode, $name): ?array
|
private function normalizeDatabaseValues($nameSingleCode, $name, $uniquekey, $iskey): ?array
|
||||||
{
|
{
|
||||||
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
|
$db_values = $this->databasetables->get($nameSingleCode . '.' . $name, null);
|
||||||
if ($db_values === null)
|
if ($db_values === null)
|
||||||
@ -1270,6 +1276,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db_values['unique_key'] = $uniquekey;
|
||||||
|
$db_values['key'] = $iskey;
|
||||||
|
|
||||||
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
|
unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']);
|
||||||
|
|
||||||
return $db_values;
|
return $db_values;
|
||||||
|
Loading…
Reference in New Issue
Block a user