<?php
use Alura\Doctrine\Entity\Aluno; use Alura\Doctrine\Entity\Telefone; use Alura\Doctrine\Helper\EntityManagerFactory;
require_once DIR . '/../vendor/autoload.php';
$entityManagerFactory = new EntityManagerFactory(); $entityManager = $entityManagerFactory->getEntityManager();
$aluno = new Aluno(); $aluno->setNome($argv[1]);
for ($i = 2; $i < $argc; $i++){ $numeroTelefone = $argv[$i]; $telefone = new Telefone(); $telefone->setNumero($numeroTelefone);
$entityManager->persisit($telefone);
$aluno->addTelefone($telefone);
}
$entityManager->persist($aluno);
$entityManager->flush();