Migrate remaining implementation

This commit is contained in:
2024-06-04 08:10:57 -04:00
parent b705130624
commit afc5d80095
10 changed files with 313 additions and 12 deletions

View File

@@ -34,4 +34,19 @@ class Document
{
Custom::nonQuery(Query::save($tableName), Parameters::json('@data', $document), $pdo);
}
/**
* Update (replace) an entire document by its ID
*
* @param string $tableName The table in which the document should be updated
* @param mixed $docId The ID of the document to be updated
* @param array|object $document The document to be updated
* @param PDO|null $pdo The database connection to use (optional; will obtain one if not provided)
* @throws DocumentException If any is encountered
*/
public static function update(string $tableName, mixed $docId, array|object $document, ?PDO $pdo = null): void
{
Custom::nonQuery(Query::update($tableName),
array_merge(Parameters::id($docId), Parameters::json('@data', $document)), $pdo);
}
}