コード例 #1
0
ファイル: OxmTestCase.php プロジェクト: GromNaN/oxm
 /**
  * @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);
 }
コード例 #2
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";
     }
     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);
 }
コード例 #3
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;
 }
コード例 #4
0
 /**
  * @return \Doctrine\OXM\Mapping\Driver\Driver
  */
 protected function _loadDriver()
 {
     $config = new \Doctrine\OXM\Configuration();
     return $config->newDefaultAnnotationDriver();
 }
コード例 #5
0
<?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;
    }
});