当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManager::__construct方法代码示例

本文整理汇总了PHP中Doctrine\ORM\EntityManager::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::__construct方法的具体用法?PHP EntityManager::__construct怎么用?PHP EntityManager::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\EntityManager的用法示例。


在下文中一共展示了EntityManager::__construct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 protected function __construct(Doctrine\DBAL\Connection $conn, Doctrine\ORM\Configuration $config, Doctrine\Common\EventManager $eventManager)
 {
     parent::__construct($conn, $config, $eventManager);
     if ($conn instanceof Kdyby\Doctrine\Connection) {
         $conn->bindEntityManager($this);
     }
 }
开发者ID:peterkrejci,项目名称:music-collection,代码行数:7,代码来源:EntityManager.php

示例2: __construct

 public function __construct(EntityManagerProvider $provider)
 {
     $this->provider = $provider;
     $connection = $provider->getDriver()->connection();
     $eventManager = $connection->getEventManager();
     $config = $provider->getConfiguration()->config();
     parent::__construct($connection, $config, $eventManager);
 }
开发者ID:paolooo,项目名称:laravel-doctrine,代码行数:8,代码来源:ProxyEntityManager.php

示例3: __construct

 /**
  * Do not use this constructor, use the factory method instead
  * @final
  * @param array $database_params in order to construct an EntityManager
  */
 protected final function __construct(array $database_params)
 {
     $connection = DriverManager::getConnection($database_params);
     // constructing an EntityManager
     parent::__construct($connection, Setup::createAnnotationMetadataConfiguration(array(COGS), Config::get('development', false)), $connection->getEventManager());
     if (isset($database_params['logging']) && $database_params['logging']) {
         $logger = new \Doctrine\DBAL\Logging\EchoSQLLogger();
         $this->getConnection()->getConfiguration()->setSQLLogger($logger);
     }
 }
开发者ID:renatomartins,项目名称:cognosys,代码行数:15,代码来源:Controller.php

示例4: __construct

 public function __construct(Connection $conn = NULL, Configuration $config = NULL, EventManager $eventManager = NULL)
 {
     $this->persisted = new ArrayCollection();
     $this->removed = new ArrayCollection();
     $this->merged = new ArrayCollection();
     $this->detached = new ArrayCollection();
     if (isset($conn)) {
         parent::__construct($conn, $config, $eventManager);
     }
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:10,代码来源:EntityManager.php

示例5: __construct

 /**
  * Creates instance of EntityManager
  */
 public function __construct()
 {
     $db = __DIR__ . '/Storage.db';
     if (self::$useCopy) {
         $tempDir = sys_get_temp_dir();
         $tempDb = $tempDir . '/erpk-common-6c814ae7-ceb3-4aeb-88f4-a42d8f05dcb6';
         copy($db, $tempDb);
         $db = $tempDb;
     }
     $cache = new ArrayCache();
     $config = new ORM\Configuration();
     $config->setMetadataCacheImpl($cache);
     $driverImpl = $config->newDefaultAnnotationDriver(__DIR__ . '/Entity');
     $config->setMetadataDriverImpl($driverImpl);
     $config->setQueryCacheImpl($cache);
     $config->setProxyDir(__DIR__ . '/Proxy');
     $config->setProxyNamespace('Erpk\\Common\\Proxy');
     $config->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_NEVER);
     $conn = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => $db], $config, new EventManager());
     parent::__construct($conn, $config, $conn->getEventManager());
 }
开发者ID:erpk,项目名称:common,代码行数:24,代码来源:EntityManager.php

示例6: __construct

 /**
  * @param string|mixed|\ $dsn
  * @param array $options
  *
  * @return AdapterInterface
  *
  * @link http://docs.doctrine-project.org/en/2.0.x/reference/configuration.html
  * @link http://docs.doctrine-project.org/en/latest/reference/tools.html
  * @link https://github.com/itmcd/StormIgniter/blob/master/app/libraries/DoctrineDb.php
  * @link http://framework.zend.com/manual/2.2/en/user-guide/database-and-models.html
  * @link http://piotrdeszynski.com/zend-framework-2-and-doctrine-2-integration.html
  * @link http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/#toc-update-the-album-controller-to-use-doctrine-instead-of-zend_db
  * @link http://framework.zend.com/manual/2.2/en/user-guide/database-and-models.html
  */
 public function __construct($conn, $options = array())
 {
     $isDev = Environment::isDev();
     // @see Doctrine\ORM\EntityManager#create()
     $config = ArrayUtils::arrayMergeRecursiveRight($options, array('cache' => $isDev ? new Cache\ArrayCache() : new Cache\ApcCache(), 'queryCache' => $isDev ? new Cache\ArrayCache() : new Cache\ApcCache(), 'modelsProxiesPath' => getcwd() . '/cache/ModelProxies'));
     // create Configuration object
     if (is_array($options)) {
         $config = $this->renderConfig($options);
         if (!$config->getMetadataDriverImpl()) {
             throw ORMException::missingMappingDriverImpl();
         }
     }
     // test EventManager object
     $eventManager = empty($options['eventManager']) ? new EventManager() : $options['eventManager'];
     switch (true) {
         case $conn instanceof \PDO:
             $conn = array('driver' => 'pdo_' . $conn->getAttribute(\PDO::ATTR_DRIVER_NAME), 'pdo' => $conn);
             $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
             break;
         case is_string($conn):
             if (($pos = strpos($conn, ':')) !== false) {
                 $driver = substr($conn, 0, $pos);
                 //                    @TODO: must implement like this, but for now throws an error about not knowing the database
                 //                    if ($driver !== 'oci8') {
                 //                        $conn = array(
                 //                            'driver' => 'pdo_' . $driver,
                 //                            'pdo' => new \PDO($conn),
                 //                        );
                 //                    } else {
                 //                        $conn = $this->mapDsnToDoctrine($conn);
                 //                    }
                 //                    ^ by dragosc@itmcd.ro / temporary replacement untill we discover why \PDO doesn't work
                 $dsn = new Dsn($conn);
                 $conn = $this->mapDsnToDoctrine($dsn->parse());
                 if ($driver !== 'oci8') {
                     $conn['driver'] = 'pdo_' . $conn['driver'];
                 }
                 //                    ^ END
             }
             $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
             break;
         case is_array($conn):
             $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
             break;
         case $conn instanceof Connection:
             if ($eventManager !== null && $conn->getEventManager() !== null) {
                 throw ORMException::mismatchedEventManager();
             }
             break;
         default:
             throw new AthemException\InvalidArgument("Invalid argument: " . json_encode($conn));
     }
     // parent constructor
     // @see Doctrine\ORM\EntityManager#__construct()
     parent::__construct($conn, $config, $conn->getEventManager());
 }
开发者ID:athemcms,项目名称:netis,代码行数:70,代码来源:EntityManager.php

示例7: __construct

 /**
  * Constructor
  *
  * @param App           $app
  * @param Connection    $conn
  * @param Configuration $config
  * @param EventManager  $eventManager
  */
 public function __construct(App $app, Connection $conn, Configuration $config, EventManager $eventManager)
 {
     parent::__construct($conn, $config, $eventManager);
     $this->app = $app;
 }
开发者ID:appcia,项目名称:webwork-core,代码行数:13,代码来源:Manager.php

示例8: __construct

 /**
  * @param Connection $conn
  * @param Configuration $config
  * @param EventManager $eventManager
  */
 protected function __construct(Connection $conn, Configuration $config, EventManager $eventManager)
 {
     parent::__construct($conn, $config, $eventManager);
     $this->setParentPrivatePropertyValue('proxyFactory', new ProxyFactory($this, $config->getProxyDir(), $config->getProxyNamespace(), $config->getAutoGenerateProxyClasses()));
     $this->setParentPrivatePropertyValue('unitOfWork', new UnitOfWork($this));
 }
开发者ID:steevanb,项目名称:doctrine-stats,代码行数:11,代码来源:EntityManager.php


注:本文中的Doctrine\ORM\EntityManager::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。