Release of v5.0.1-alpha5

Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
2024-06-21 03:25:28 +02:00
parent fc6b04cb5c
commit c51ef999a9
120 changed files with 8945 additions and 3699 deletions

View File

@@ -40,15 +40,7 @@ final class Load extends Database implements LoadInterface
?array $order = null, ?int $limit = null): ?array
{
// set key if found
$key = '';
if (isset($select['key']))
{
if (is_string($select['key']))
{
$key = $select['key'];
}
unset($select['key']);
}
$key = $this->getKey($select);
// check if we can get many rows
if ($this->many($select, $tables, $where, $order, $limit))
@@ -77,15 +69,7 @@ final class Load extends Database implements LoadInterface
?array $order = null, ?int $limit = null): ?array
{
// set key if found
$key = '';
if (isset($select['key']))
{
if (is_string($select['key']))
{
$key = $select['key'];
}
unset($select['key']);
}
$key = $this->getKey($select);
// check if we can get many rows
if ($this->many($select, $tables, $where, $order, $limit))
@@ -464,6 +448,30 @@ final class Load extends Database implements LoadInterface
return $query;
}
/**
* Get the key from the selection array.
*
* This function retrieves a key from the provided selection array.
* The key is removed from the array after being retrieved.
*
* @param array $select Array of selection keys.
*
* @return string|null The key, or null if no key is found.
* @since 3.2.2
**/
protected function getKey(array &$select): ?string
{
$key = null;
// Check for 'key' first and ensure it's a string.
if (isset($select['key']) && is_string($select['key']))
{
$key = $select['key'];
unset($select['key']); // Remove 'key' from the array.
}
return $key;
}
}