Add classes and tests from common project

This commit is contained in:
2024-06-03 19:46:39 -04:00
parent e91acee70f
commit 1164dc7cc5
32 changed files with 3175 additions and 0 deletions

32
src/Configuration.php Normal file
View File

@@ -0,0 +1,32 @@
<?php declare(strict_types=1);
namespace BitBadger\PDODocument;
/**
* Common configuration for the document library
*/
class Configuration
{
/** @var string The name of the ID field used in the database (will be treated as the primary key) */
private static string $_idField = 'id';
/**
* Configure the ID field used by the library
*
* @param string $name The name of the ID field within each document
*/
public static function useIdField(string $name): void
{
self::$_idField = $name;
}
/**
* Retrieve the ID field for documents within this library
*
* @return string The configured ID field
*/
public static function idField(): string
{
return self::$_idField;
}
}