-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRowWriter.php
More file actions
39 lines (36 loc) · 1.28 KB
/
Copy pathRowWriter.php
File metadata and controls
39 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/**
* Italix Testing - RowWriter
*
* @package Italix\Testing
*/
declare(strict_types=1);
namespace Italix\Testing;
/**
* The one thing a factory needs from a database: put this row in that table.
*
* Declared here rather than in `Italix\Contracts` because nothing else in the
* framework consumes it. `Contracts` is the seam between libraries (house rule
* 6); an interface with a single consumer belongs with its consumer, where it
* can change without a compatibility event.
*
* `PdoRowWriter` is the shipped implementation. Anything else — a fake that
* records rows in memory, a writer that routes through an application's own
* persistence layer — is three lines.
*/
interface RowWriter
{
/**
* Insert one row and return the generated primary key, if there is one.
*
* @param array<string, mixed> $row Column name => value
* @return string|null Last insert id, or null when the table
* has no auto-generated key
*/
public function insert(string $table_name, array $row): ?string;
}