Migrate remaining implementation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user