protected function setUp() { $this->entityManager = getEntityManager(); $this->userRepository = $this->entityManager->getRepository('AppBundle\\Entity\\User'); $this->user = new User(); $this->user->setUsername("Alvaro Martin")->setUsernameCanonical(strtolower("Alvaro Martin"))->setEmail("*****@*****.**")->setEmailCanonical(strtolower("*****@*****.**"))->setPassword(password_hash('WowSoSecretPassword', PASSWORD_DEFAULT))->setRoles(['ROLE_MANAGER', 'ROLE_PLAYER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN'])->setEnabled(true)->setSalt("AnRandomlyGeneratedSalt")->setLocked(false)->setExpired(false)->setCredentialsExpired(false); $this->tearDown(); // Clean database (this exercise is sharing DB for all environments) }
protected function setUp() { $this->entityManager = getEntityManager(); $this->groupRepository = $this->entityManager->getRepository('AppBundle\\Entity\\Group'); $this->userRepository = $this->entityManager->getRepository('AppBundle\\Entity\\User'); $this->group = new Group(); $this->group->setName("EXAMPLE__TEST_GROUP"); $this->user = new User(); $this->user->setUsername("Mario Perez")->setUsernameCanonical(strtolower("Mario Perez"))->setEmail("*****@*****.**")->setEmailCanonical(strtolower("*****@*****.**"))->setPassword(password_hash('WowSoSecretPassword', PASSWORD_DEFAULT))->setRoles(['ROLE_MANAGER', 'ROLE_PLAYER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN'])->setEnabled(true)->setSalt("AnRandomlyGeneratedSalt")->setLocked(false)->setExpired(false)->setCredentialsExpired(false); $this->tearDown(); // Clean database (this exercise is sharing DB for all environments) }
<?php use Doctrine\Common\Collections\ArrayCollection; // create_product.php require_once "bootstrap.php"; $em = getEntityManager(); //$productRepository = $entityManager->getRepository('Taureau'); $sport = $em->getRepository('Sport')->findOneBy(array('nom' => $argv[1])); echo 'sport : ' . $sport->getNom() . "\n"; $format = 'd-m-Y H:i:s'; var_dump($argv[2]); $datetime = new DateTime($argv[2]); var_dump($datetime); $lieu = $argv[3]; $title = $argv[4]; $description = $argv[5]; $event = new Evenement($sport, $datetime, $lieu, $title, $description); $em->persist($event); $em->flush(); $repo = $em->getRepository('Evenement'); $events = $repo->findAll(); foreach ($events as $event) { echo $event->getId() . " - " . $event->getSport()->getNom() . " - " . $event->getDate() . "\n"; }
function eventpicture() { var_dump($_POST); $em = getEntityManager(); $event = $em->find('Evenement', $_POST['event']); $cheminPhoto = $_POST['cheminPhoto']; $event->setDossierPhotos($cheminPhoto); $em->persist($event); $em->flush(); header('Location: ?/admin'); }