Está dizendo que a classe ConnectionCreator não foi encontrada, sendo que dei um use nela usando o proprio autoload
inserirAluno.php
<?php
use Alura\Pdo\Domain\Model\Student;
use PDO\Infra\Persistence\ConnectionCreator;
require_once 'vendor/autoload.php';
$pdo = ConnectionCreator::createConnection();
$student = new Student(
null,
'joao carlo',
new DateTimeImmutable('2003-10-03'));
$sqlInsert = "INSERT INTO students (name, birth_date) values (:name,:birth_date);";
$statement = $pdo->prepare($sqlInsert);
$statement->bindValue(':name',$student->name());
$statement->bindValue(':birth_date',$student->birthDate()->format('Y-m-d'));
$statement->execute();
if($statement->execute()){
echo "Aluno cadastro com sucesso";
}
ConnectionCreator.php
<?php
namespace PDO\Infra\Persistence;
use PDO;
class ConnectionCreator
{
public static function createConnection(): PDO
{
$databasePath = __DIR__ . '/../../../banco.sqlite';
return new PDO('sqlite:' . $databasePath);
}
}