Skip to content
This repository
Browse code

[DDC-1698] Autoloading proxies

  • Loading branch information...
commit 01381fae1ff3d4944086c7cfe46721925bf6ca15 1 parent 7782f91
Benjamin Eberlei authored March 14, 2012

Showing 1 changed file with 25 additions and 0 deletions. Show diff stats Hide diff stats

  1. 25  en/reference/configuration.rst
25  en/reference/configuration.rst
Source Rendered
@@ -471,6 +471,29 @@ proxy classes like so:
471 471
 
472 472
     $ ./doctrine orm:generate-proxies
473 473
 
  474
+Autoloading Proxies
  475
+-------------------
  476
+
  477
+When you deserialize proxy objects from the session or any other storage
  478
+it is necessary to have an autoloading mechanism in place for these classes.
  479
+For implementation reasons Proxy class names are not PSR-0 compliant. This
  480
+means that you have to register a special autoloader for these classes:
  481
+
  482
+.. code-block:: php
  483
+
  484
+    <?php
  485
+    use Doctrine\ORM\Proxy\Autoloader;
  486
+
  487
+    $proxyDir = "/path/to/proxies";
  488
+    $proxyNamespace = "MyProxies";
  489
+
  490
+    Autoloader::register($proxyDir, $proxyNamespace);
  491
+
  492
+If you want to execute additional logic to intercept the proxy file not found
  493
+state you can pass a closure as the third argument. It will be called with
  494
+the arguments proxydir, namespace and className when the proxy file could not
  495
+be found.
  496
+
474 497
 Multiple Metadata Sources
475 498
 -------------------------
476 499
 
@@ -482,6 +505,8 @@ aggregate these drivers based on namespaces:
482 505
 .. code-block:: php
483 506
 
484 507
     <?php
  508
+    use Doctrine\ORM\Mapping\Driver\DriverChain;
  509
+
485 510
     $chain = new DriverChain();
486 511
     $chain->addDriver($xmlDriver, 'Doctrine\Tests\Models\Company');
487 512
     $chain->addDriver($yamlDriver, 'Doctrine\Tests\ORM\Mapping');

0 notes on commit 01381fa

Please sign in to comment.
Something went wrong with that request. Please try again.