-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.php
More file actions
37 lines (27 loc) · 719 Bytes
/
test.php
File metadata and controls
37 lines (27 loc) · 719 Bytes
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
<?php
require __DIR__ . '/vendor/autoload.php';
use EntityForge\Core\Application;
use EntityForge\Tenant\TenantProvisioner;
use App\Repository\UserRepository;
$app = new Application(__DIR__ . '/config');
$app->boot([], false);
$config = $app->getConfig();
$tenantId = 'tenant_2';
$provisioner = new TenantProvisioner($config);
try {
$provisioner->create($tenantId);
} catch (\Throwable $e) {
echo "Provisioning skipped or failed: " . $e->getMessage() . PHP_EOL;
}
$app->boot([
'headers' => [
'X-Tenant-ID' => $tenantId
]
], true);
$repo = new UserRepository($config);
$user = $repo->create([
'name' => 'Ved',
'email' => 'ved@example.com'
]);
echo "Inserted:\n";
print_r($user);