First implementation of the Remap
.
Now it can hydrate any objects from the result of querying a database:
final class Todo
{
public int $id;
public string $title;
public int $status;
public int $created_at;
}
$sql = 'SELECT id, title, status, created_at FROM todo WHERE id = :id LIMIT 1';
$params = ['id' => 1];
$remap->map(Todo::class, $sql, $params); // returns \Generator of Todo objects