C:\php\php.exe C:\Users\Rubinho\Desktop\php-pdo-projeto-completo-aula-4\criar-turma.php PHP Fatal error: Uncaught Error: Class "Alura\Pdo\Infraestructure\Persistence\ConnectionCreator" not found in C:\Users\Rubinho\Desktop\php-pdo-projeto-completo-aula-4\criar-turma.php:8 Stack trace:
#0 {main} thrown in C:\Users\Rubinho\Desktop\php-pdo-projeto-completo-aula-4\criar-turma.php on line 8
Fatal error: Uncaught Error: Class "Alura\Pdo\Infraestructure\Persistence\ConnectionCreator" not found in C:\Users\Rubinho\Desktop\php-pdo-projeto-completo-aula-4\criar-turma.php:8 Stack trace:
#0 {main} thrown in C:\Users\Rubinho\Desktop\php-pdo-projeto-completo-aula-4\criar-turma.php on line 8
Process finished with exit code 255
<?php
use Alura\Pdo\Infraestructure\Persistence\ConnectionCreator; use Alura\Pdo\Infraestructure\Repository\PdoStudentRepository;
require_once 'vendor/autoload.php';
$connection = ConnectionCreator::createConnection(); $studentRepository = new PdoStudentRepository($connection);
$connection->beginTransaction();
$aStudent = new Student( null, 'Nico Steppat', new DateTimeimmutable('1985-05-01') );
$studentRepository->save($aStudent);
$anotherStudent = new Student( null, 'Sergio Lopes', new DateTimeimmutable('1985-05-01') );
$studentRepository->save($anotherStudent);
$connection->commit();