<?php
use Alura\Pdo\Domain\Model\Student;
use Alura\Pdo\Infra\Persistence\ConnectionCreator;
require_once 'vendor/autoload.php';
$pdo = ConnectionCreator::createConnection();
$student = new Student(null,"Carlos Albero Nobrega",new DateTimeImmutable('1984-05-21')
);
$name1 = $student->name();
$sqlInsert = "INSERT INTO students (name, birth_date) VALUES (:name, :birth_date);";
$statement = $pdo->prepare($sqlInsert);
$statement->bindParam(':name', $name1);
$statement->bindValue(':birth_date', $student->birthDate()->format('Y-m-d'));
if ($statement->execute()) {
echo "Aluno incluído";
}