-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profile.php
78 lines (71 loc) · 2.33 KB
/
Profile.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
require_once(__DIR__."/vendor/autoload.php");
require_once __DIR__.'/config.php';
$api = new Datatrics\API\Client($apiKey, $projectId);
$genders = ['male', 'female'];
$gender = $genders[mt_rand(0, count($genders) - 1)];
$faker = Faker\Factory::create();
$faker->seed(0);
$profile = [
"projectid" => $projectId,
"profileid" => "profile-0",
"source" => "MyWebshop",
"profile" => [
"created" => date('Y-m-d H:i:s', $faker->unixTime),
"updated" => date('Y-m-d H:i:s'),
"company" => $faker->company,
"dateofbirth" => $faker->date(),
"firstname" => $faker->firstName,
"lastname" => $faker->lastName,
"zip" => $faker->postcode,
"city" => $faker->city,
"country" => $faker->country,
"address" => $faker->streetAddress,
"phone" => $faker->phoneNumber,
"nationality" => $faker->country,
"mobile" => $faker->format('e164PhoneNumber'),
"title" => $faker->title,
"prefix" => $faker->suffix,
"email" => $faker->safeEmail,
"lang" => $faker->languageCode,
"gender" => $gender
]
];
$profile = $api->Profile->Create($profile);
echo "<pre>";
print_r($profile);
echo "</pre>";
$profiles = [];
for ($i=1;$i<=10;$i++) {
$faker->seed($i);
$profiles[] = [
"projectid" => $projectId,
"profileid" => "profile-".$i,
"objecttype" => "profile",
"source" => "MyWebshop",
"profile" => [
"created" => date('Y-m-d H:i:s', $faker->unixTime),
"updated" => date('Y-m-d H:i:s'),
"company" => $faker->company,
"dateofbirth" => $faker->date(),
"firstname" => $faker->firstName,
"lastname" => $faker->lastName,
"zip" => $faker->postcode,
"city" => $faker->city,
"country" => $faker->country,
"address" => $faker->streetAddress,
"phone" => $faker->phoneNumber,
"nationality" => $faker->country,
"mobile" => $faker->format('e164PhoneNumber'),
"title" => $faker->title,
"prefix" => $faker->suffix,
"email" => $faker->safeEmail,
"lang" => $faker->languageCode,
"gender" => $gender
]
];
}
$profiles = $api->Profile->Bulk($profiles);
echo "<pre>";
print_r($profiles);
echo "</pre>";