blob: 4cd27b39b9e482a1ec1361aebe62438935fe58ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
namespace Tolkiendil\AssoBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Tolkiendil\AssoBundle\Entity\Member;
use Tolkiendil\AssoBundle\Entity\Subscription;
/**
* Member Fixtures
*/
class MemberFixtures implements FixtureInterface
{
public function load(ObjectManager $manager)
{
for ($i = 0; $i < 3; $i++) {
$member = new Member();
$member->setFirstName('Prenom'.$i);
$member->setLastName('Nom'.$i);
$member->setNickname('Pseudo'.$i);
$member->setAddress('At the top '.$i);
$member->setZip('MT-1234-'.$i);
$member->setPlace('Minas Tirith');
$member->setNationality('Gondorian');
$member->setCountry('Middle Earth');
$member->setPhoneNumber('0123456'.$i);
$member->setMobileNumber('09876543'.$i);
$member->setEmail($i.'@sauron.mordor');
$member->setBirthDate(new \DateTime());
$member->setBirthPlace('Valmar');
$member->setMembershipStart(new \DateTime());
$member->setActive(true);
$member->setComment("Blablabla ".$i);
for ($index = 0; $index < 5; $index++) {
$subscription = new Subscription();
$subscription->setDate(new \DateTime());
$subscription->setStart(new \DateTime());
$subscription->setEnd(new \DateTime());
$subscription->setAmount($index+100.5);
$subscription->setPaymentMethod("Virement");
$subscription->setComment("Cotisation ".$index);
$member->addSubscription($subscription);
$manager->persist($subscription);
}
$manager->persist($member);
}
$manager->flush();
}
}
|