-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.php
More file actions
29 lines (25 loc) · 938 Bytes
/
proxy.php
File metadata and controls
29 lines (25 loc) · 938 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
<?php
use Doctrine\ORM\ORMSetup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Proxy\ProxyFactory;
use Doctrine\DBAL\DriverManager;
// Require Composer's autoloader
require_once 'vendor/autoload.php';
// Doctrine configuration
$isDevMode = false;
$dbParams = [
'dbname' => 'proxy_cart',
'user' => 'pc_admin',
'password' => 'pcadminpass',
'host' => 'localhost',
'driver' => 'pdo_mysql',
];
$proxyDir = __DIR__ . '/tmp';
$metadataConfig = ORMSetup::createAttributeMetadataConfiguration(array(__DIR__ . '/../'), $isDevMode, $proxyDir);
$connection = DriverManager::getConnection($dbParams, $metadataConfig);
$entityManager = new EntityManager($connection, $metadataConfig);
// Get the ProxyFactory
$proxyFactory = $entityManager->getProxyFactory();
// Regenerate proxies
$proxyFactory->generateProxyClasses($entityManager->getMetadataFactory()->getAllMetadata());
echo "Proxies regenerated successfully.\n";