Estou com esse problema na aula 5 de transações.
Fatal error: Uncaught Error: Interface "Alura\Pdo\Domain\Repository\StudentRepository" not found in C:\xampp\htdocs\ProjetoInicial\src\Infrastructure\Repository\PdoStudentRepository.php:10 Stack trace: #0 C:\xampp\htdocs\ProjetoInicial\vendor\composer\ClassLoader.php(480): include() #1 C:\xampp\htdocs\ProjetoInicial\vendor\composer\ClassLoader.php(346): Composer\Autoload\includeFile('C:\xampp\htdocs...') #2 C:\xampp\htdocs\ProjetoInicial\criar-turma.php(10): Composer\Autoload\ClassLoader->loadClass('Alura\Pdo\Infra...') #3 {main} thrown in C:\xampp\htdocs\ProjetoInicial\src\Infrastructure\Repository\PdoStudentRepository.php on line 10
O caminho para o repository esta correto e já executei o composer dumpautoload
.
<?php
use Alura\Pdo\Domain\Model\Student;
use Alura\Pdo\Infrastructure\Persistence\ConnectionCreator;
use Alura\Pdo\Infrastructure\Repository\PdoStudentRepository;
require_once 'vendor/autoload.php';
$connection = ConnectionCreator::creatorConnection();
$studentRepository = new PdoStudentRepository($connection);
$connection->beginTransaction();
$aStudent = new Student(
null,
'Marlon',
new DateTimeImmutable('1949-05-01')
);
$studentRepository->save($aStudent);
$anotherStudent = new Student(
null,
'Ronaldinho',
new DateTimeImmutable('1999-12-12')
);
$studentRepository->save($anotherStudent);
$connection->commit();
Link do meu repositorio no GitHub: https://github.com/lbethuel/pdoStudent