Example #1
0
 /**
  * @param  $paths
  * @return \Doctrine\OXM\Marshaller\Marshaller
  */
 protected function _getMarshaller($paths)
 {
     $config = new \Doctrine\OXM\Configuration();
     if (empty($paths)) {
         $paths = "tests/Doctrine/Tests/OXM/Entities";
     }
     $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths));
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $metadataFactory = new \Doctrine\OXM\Mapping\ClassMetadataFactory($config);
     return new \Doctrine\OXM\Marshaller\XmlMarshaller($metadataFactory);
 }
Example #2
0
 /**
  * @static
  * @param \Doctrine\OXM\Storage\Storage|null $storage
  * @param \Doctrine\OXM\Configuration|null $config
  * @param \Doctrine\Common\EventManager|null $eventManager
  * @return XmlEntityManagerMock
  */
 public static function create(\Doctrine\OXM\Storage\Storage $storage = null, \Doctrine\OXM\Configuration $config = null, \Doctrine\Common\EventManager $eventManager = null)
 {
     if (is_null($storage)) {
         $storage = new \Doctrine\OXM\Storage\FileSystemStorage(__DIR__ . '/../Workspace');
     }
     if (is_null($config)) {
         $config = new \Doctrine\OXM\Configuration();
         $config->setMetadataDriverImpl(\Doctrine\OXM\Mapping\Driver\AnnotationDriver::create(__DIR__ . '/../OXM/Entities'));
     }
     if (is_null($eventManager)) {
         $eventManager = new \Doctrine\Common\EventManager();
     }
     return new XmlEntityManagerMock($storage, $config, $eventManager);
 }
 /**
  * @param  $paths
  * @return \Doctrine\OXM\Marshaller\Marshaller
  */
 protected function _getMarshaller($paths)
 {
     $config = new \Doctrine\OXM\Configuration();
     if (empty($paths)) {
         $paths = "tests/Doctrine/Tests/OXM/Entities";
     }
     if (!is_array($paths)) {
         $paths = array($paths);
     }
     foreach ($paths as $key => $path) {
         if (substr($path, 0, 1) !== '/') {
             $paths[$key] = __DIR__ . '/../../../' . $path;
         }
     }
     $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($paths));
     \Doctrine\OXM\Mapping\Driver\AnnotationDriver::registerAnnotationClasses();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $metadataFactory = new \Doctrine\OXM\Mapping\ClassMetadataFactory($config);
     return new \Doctrine\OXM\Marshaller\XmlMarshaller($metadataFactory);
 }
Example #4
0
 private static function createOxmConfiguration()
 {
     $applicationMode = "development";
     if ($applicationMode == "development") {
         $cache = new Doctrine\Common\Cache\ArrayCache();
     } else {
         $cache = new Doctrine\Common\Cache\ApcCache();
     }
     $config = new Doctrine\OXM\Configuration();
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(THISPATH . '/entities');
     $config->setMetadataDriverImpl($driverImpl);
     //$config->setQueryCacheImpl($cache);
     $config->setProxyDir(THISPATH . '/proxy');
     $config->setProxyNamespace('Verify\\Proxies');
     $config->setEntityNamespaces(array('entities'));
     if ($applicationMode == "development") {
         $config->setAutoGenerateProxyClasses(true);
     } else {
         $config->setAutoGenerateProxyClasses(false);
     }
     self::$oxmConfig = $config;
 }
 /**
  * @return \Doctrine\OXM\Mapping\Driver\Driver
  */
 protected function _loadDriver()
 {
     $config = new \Doctrine\OXM\Configuration();
     return $config->newDefaultAnnotationDriver();
 }
<?php

define('VENDOR_DIR', is_dir(__DIR__ . '/../vendor/doctrine-common') ? __DIR__ . '/../vendor' : __DIR__ . '/../lib/vendor');
require_once VENDOR_DIR . '/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
$loader = new \Doctrine\Common\ClassLoader('Doctrine\\Common', VENDOR_DIR . '/doctrine-common/lib');
$loader->register();
$loader = new \Doctrine\Common\ClassLoader('Doctrine', __DIR__ . '/../lib');
$loader->register();
$loader = new \Doctrine\Common\ClassLoader('Symfony', VENDOR_DIR);
$loader->register();
$loader = new \Doctrine\Common\ClassLoader('Documents', __DIR__);
$loader->register();
$paths = __DIR__ . '/Documents';
$config = new \Doctrine\OXM\Configuration();
$config->setProxyDir(\sys_get_temp_dir());
$config->setProxyNamespace('Doctrine\\Sandbox\\Proxies');
$metaDriver = $config->newDefaultAnnotationDriver(array($paths));
$config->setMetadataDriverImpl($metaDriver);
\Doctrine\OXM\Mapping\Driver\AnnotationDriver::registerAnnotationClasses();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
$storage = new \Doctrine\OXM\Storage\FileSystemStorage(__DIR__ . '/Workspace');
$dm = new \Doctrine\OXM\XmlEntityManager($storage, $config);
ob_start(function ($output) {
    if (PHP_SAPI != "cli") {
        return nl2br($output);
    } else {
        return $output;
    }
});