Esempio n. 1
0
 /**
  * Get a reference to the only instance of database class and connects to DB
  *
  * if the class has not been instantiated yet, this will also take
  * care of that
  *
  * Doctrine connection function
  *
  * NOTE: Persistance connection is not included. XOOPS_DB_PCONNECT is ignored.
  *       allowWebChanges also needs to be addressed
  *
  * @param array $options driverOptions for Doctrine
  *
  * @return Connection|null Reference to the only instance of database class
  *
  * @todo change driver to support other databases and support for port, unix_socket and driver options.
  */
 public static function getConnection($options = null)
 {
     static $instance;
     if (!isset($instance)) {
         $xoops = \Xoops::getInstance();
         $config = new \Doctrine\DBAL\Configuration();
         $config->setSQLLogger(new XoopsDebugStack());
         $parameters = \XoopsBaseConfig::get('db-parameters');
         if (!empty($parameters) && is_array($parameters)) {
             $connectionParams = $parameters;
             $connectionParams['wrapperClass'] = '\\Xoops\\Core\\Database\\Connection';
         } else {
             $driver = 'pdo_' . \XoopsBaseConfig::get('db-type');
             $connectionParams = array('dbname' => \XoopsBaseConfig::get('db-name'), 'user' => \XoopsBaseConfig::get('db-user'), 'password' => \XoopsBaseConfig::get('db-pass'), 'host' => \XoopsBaseConfig::get('db-host'), 'charset' => \XoopsBaseConfig::get('db-charset'), 'driver' => $driver, 'wrapperClass' => '\\Xoops\\Core\\Database\\Connection');
             // Support for other doctrine databases
             $xoops_db_port = \XoopsBaseConfig::get('db-port');
             if (!empty($xoops_db_port)) {
                 $connectionParams['port'] = $xoops_db_port;
             }
             $xoops_db_socket = \XoopsBaseConfig::get('db-socket');
             if (!empty($xoops_db_socket)) {
                 $connectionParams['unix_socket'] = $xoops_db_socket;
             }
             if (!is_null($options) && is_array($options)) {
                 $connectionParams['driverOptions'] = $options;
             }
         }
         $instance = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
     }
     return $instance;
 }
 /**
  * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
  * and returns the number of affected rows.
  *
  * This method supports PDO binding types as well as DBAL mapping types.
  *
  * @param string $query The SQL query.
  * @param array $params The query parameters.
  * @param array $types The parameter types.
  * @return integer The number of affected rows.
  * @internal PERF: Directly prepares a driver statement, not a wrapper.
  */
 public function executeUpdate($query, array $params = array(), array $types = array())
 {
     $this->connect();
     $hasLogger = $this->_config->getSQLLogger() !== null;
     if ($hasLogger) {
         $this->_config->getSQLLogger()->startQuery($query, $params, $types);
     }
     if ($params) {
         list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types);
         $stmt = $this->_conn->prepare($query);
         if ($types) {
             $this->_bindTypedValues($stmt, $params, $types);
             $stmt->execute();
         } else {
             $stmt->execute($params);
         }
         $result = $stmt->rowCount();
     } else {
         $result = $this->_conn->exec($query);
     }
     if ($hasLogger) {
         $this->_config->getSQLLogger()->stopQuery();
     }
     return $result;
 }
Esempio n. 3
0
 public static function getInstance()
 {
     if (!self::$instance) {
         try {
             $configuration = new \Doctrine\DBAL\Configuration();
             $configuration->setSQLLogger(new \Doctrine\DBAL\Logging\ProfileSQLLogger());
             self::$instance = \Doctrine\DBAL\DriverManager::getConnection(App::getConfig('database'), $configuration);
             self::$instance->query('set names "utf8"');
             self::$instance->query('set character_set_server="utf8"');
             self::$instance->query('set collation_connection="utf8_general_ci"');
         } catch (\PDOException $e) {
             require_once ROOTPATH . 'design' . DS . 'error.php';
             die;
         }
     }
     return self::$instance;
 }
Esempio n. 4
0
 /**
  * Create a database handle
  * Factory method
  * @param array params
  *  engine - pdo
  *      type - mysql
  *
  * @return \Doctrine\DBAL\Connection
  */
 public static function get_doctrine($id = self::DEFAULT_CONNECTION, array $config = array())
 {
     if (empty($config) && !isset(self::$dbs[$id])) {
         throw new dbal_exception('Try to get unloaded db connection : ' . $id);
     }
     $engine = @$config['engine'] ?: 'pdo_mysql';
     if (isset(self::$dbs[$id])) {
         return self::$dbs[$id];
     }
     core::dprint('[dbloader|doctrine::get] ' . $id . '(' . $engine . ')');
     if ($engine == 'null') {
         if (!class_exists('null_db', 0)) {
             require "modules/core/dbal/null.php";
         }
         $conn = new null_db();
         self::$dbs[$id] = $conn;
     } else {
         $d_config = new \Doctrine\DBAL\Configuration();
         $d_config->setSQLLogger(new \SatCMS\Modules\Core\Dbal\Doctrine\Logger());
         /*
         *    'dbname'    => @$config['database']
            , 'user'      => @$config['login'] ?: 'root'
            , 'password'  => @$config['password']
            , 'host'      => @$config['server'] ?: 'localhost'
            , 'driver'    => $engine
            , 'path'      => (isset($config['path']) ? loader::get_root($config['path']) : null)
         */
         $connection_params = array('driver' => $engine, 'prefix' => @$config['prefix'], 'charset' => 'UTF8');
         unset($config['engine']);
         // fix path
         if (isset($config['path'])) {
             $config['path'] = loader::get_root($config['path']);
         }
         // merge params
         $connection_params = array_merge($connection_params, $config);
         core::dprint_r($connection_params);
         try {
             $conn = \Doctrine\DBAL\DriverManager::getConnection($connection_params, $d_config);
             self::$dbs[$id] = $conn;
         } catch (Exception $e) {
             core::dprint($e->getMessage());
             return false;
         }
     }
     return self::$dbs[$id];
 }
Esempio n. 5
0
 /**
  * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters.
  *
  * @param string $query     sql query
  * @param array $params     query parameters
  * @return integer
  */
 public function executeUpdate($query, array $params = array())
 {
     $this->connect();
     if ($this->_config->getSqlLogger()) {
         $this->_config->getSqlLogger()->logSql($query, $params);
     }
     if (!empty($params)) {
         $stmt = $this->_conn->prepare($query);
         $stmt->execute($params);
         $result = $stmt->rowCount();
     } else {
         $result = $this->_conn->exec($query);
     }
     return $result;
 }
 /**
  * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
  * and returns the number of affected rows.
  * 
  * This method supports PDO binding types as well as DBAL mapping types.
  *
  * @param string $query The SQL query.
  * @param array $params The query parameters.
  * @param array $types The parameter types.
  * @return integer The number of affected rows.
  * @internal PERF: Directly prepares a driver statement, not a wrapper.
  */
 public function executeUpdate($query, array $params = array(), array $types = array())
 {
     $this->connect();
     if ($this->_config->getSQLLogger() !== null) {
         $this->_config->getSQLLogger()->logSQL($query, $params);
     }
     if ($params) {
         $stmt = $this->_conn->prepare($query);
         if ($types) {
             $this->_bindTypedValues($stmt, $params, $types);
             $stmt->execute();
         } else {
             $stmt->execute($params);
         }
         $result = $stmt->rowCount();
     } else {
         $result = $this->_conn->exec($query);
     }
     return $result;
 }
Esempio n. 7
0
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = $this->get('annotation_reader');
     $b = new \Doctrine\DBAL\Logging\LoggerChain();
     $b->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $b->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $c = new \Doctrine\DBAL\Configuration();
     $c->setSQLLogger($b);
     $d = new \Gedmo\SoftDeleteable\SoftDeleteableListener();
     $d->setAnnotationReader($a);
     $e = new \Gedmo\Sortable\SortableListener();
     $e->setAnnotationReader($a);
     $f = new \Gedmo\Sluggable\SluggableListener();
     $f->setAnnotationReader($a);
     $g = new \Gedmo\Timestampable\TimestampableListener();
     $g->setAnnotationReader($a);
     $h = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $h->addEventSubscriber($d);
     $h->addEventSubscriber($this->get('bigfoot_context.subscriber.doctrine'));
     $h->addEventSubscriber($e);
     $h->addEventSubscriber($f);
     $h->addEventSubscriber($this->get('stof_doctrine_extensions.listener.blameable'));
     $h->addEventSubscriber($g);
     $h->addEventSubscriber($this->get('stof_doctrine_extensions.listener.translatable'));
     $h->addEventListener(array(0 => 'onFlush', 1 => 'postPersist', 2 => 'postUpdate', 3 => 'postRemove'), $this->get('bigfoot_core.doctrine_listener'));
     $h->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_sqlite', 'host' => NULL, 'port' => NULL, 'dbname' => NULL, 'user' => NULL, 'password' => NULL, 'charset' => 'UTF8', 'path' => $this->targetDirs[3] . '/app/database/sf3_database.sqlite', 'driverOptions' => array(), 'defaultTableOptions' => array()), $c, $h, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber(new \FOS\UserBundle\Doctrine\Orm\UserListener($this));
     $c->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => 8889, 'dbname' => 'crm_symfony', 'user' => 'root', 'password' => 'root', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Doctrine\ORM\Tools\ResolveTargetEntityListener();
     $c->addResolveTargetEntity('Civix\\BalancedBundle\\Model\\BalancedUserInterface', 'Civix\\CoreBundle\\Entity\\Customer\\Customer', array());
     $d = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $d->addEventSubscriber(new \Vich\UploaderBundle\EventListener\UploaderListener($this->get('vich_uploader.adapter'), $this->get('vich_uploader.annotation_driver'), $this->get('vich_uploader.storage'), $this->get('vich_uploader.file_injector')));
     $d->addEventListener(array(0 => 'loadClassMetadata'), $c);
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => 'civixdevdb.c5ywiczyhtjr.us-east-1.rds.amazonaws.com', 'port' => NULL, 'dbname' => 'civixdevdb', 'user' => 'civixdevdb', 'password' => 'civixdevdb', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $d, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = $this->get('vich_uploader.metadata_reader');
     $b = $this->get('vich_uploader.upload_handler');
     $c = new \Doctrine\DBAL\Logging\LoggerChain();
     $c->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $c->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $d = new \Doctrine\DBAL\Configuration();
     $d->setSQLLogger($c);
     $e = new \Vich\UploaderBundle\Adapter\ORM\DoctrineORMAdapter();
     $f = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\CleanListener('gallery_images', $e, $a, $b));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\CleanListener('achievement_images', $e, $a, $b));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\RemoveListener('gallery_images', $e, $a, $b));
     $f->addEventSubscriber(new \FOS\UserBundle\Doctrine\UserListener($this));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\RemoveListener('achievement_images', $e, $a, $b));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\UploadListener('achievement_images', $e, $a, $b));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\UploadListener('gallery_images', $e, $a, $b));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => 'sql.karas1993.nazwa.pl', 'port' => 3306, 'dbname' => 'karas1993', 'user' => 'karas1993', 'password' => 'Kkoaw1492', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $d, $f, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber($this->get('sonata.easy_extends.doctrine.mapper'));
     $c->addEventSubscriber(new \FOS\UserBundle\Entity\UserListener($this));
     $c->addEventListener(array(0 => 'postGenerateSchema'), 'security.acl.dbal.schema_listener');
     $c->addEventListener(array(0 => 'postGenerateSchema'), 'doctrine_phpcr.jackalope_doctrine_dbal.schema_listener');
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '192.168.50.4', 'port' => NULL, 'dbname' => 'cmf', 'user' => 'external', 'password' => 'external', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger($this->get('doctrine.dbal.logger'));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber($this->get('fos_user.user_listener'));
     $c->addEventListener(array(0 => 'postPersist'), $this->get('my.listener'));
     $c->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     $c->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.archive_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => NULL, 'dbname' => 'trdc', 'user' => 'root', 'password' => NULL, 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Configuration();
     $a->setSQLLogger($this->get('doctrine.dbal.logger'));
     $b = new \Doctrine\Common\EventManager();
     $b->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit('UTF8'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('dbname' => 'symfony', 'host' => 'localhost', 'port' => '', 'user' => 'root', 'password' => '', 'driver' => 'pdo_mysql', 'driverOptions' => array()), $a, $b, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger(new \Doctrine\DBAL\Logging\DebugStack());
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber(new \FOS\UserBundle\Doctrine\Orm\UserListener($this));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => 'mysql1.alwaysdata.com', 'port' => NULL, 'dbname' => 'checo1983_pets', 'user' => 'checo1983', 'password' => 'ciphron', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * @return Doctrine\DBAL\Configuration
  */
 public function createServiceDoctrine__default__dbalConfiguration()
 {
     $service = new Doctrine\DBAL\Configuration();
     $service->setResultCacheImpl($this->getService('doctrine.cache.default.dbalResult'));
     $service->setSQLLogger(new Doctrine\DBAL\Logging\LoggerChain());
     return $service;
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Gedmo\Timestampable\TimestampableListener();
     $c->setAnnotationReader($this->get('annotation_reader'));
     $d = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $d->addEventSubscriber($c);
     $d->addEventSubscriber(new \FOS\UserBundle\Doctrine\UserListener($this->get('fos_user.util.password_updater'), $this->get('fos_user.util.canonical_fields_updater')));
     $d->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => NULL, 'dbname' => 'rest', 'user' => 'rest', 'password' => 'Ium2F2CZHMdEj7OP8L5mcT1xfawNc2dt', 'charset' => 'UTF8', 'driverOptions' => array(), 'serverVersion' => 5.6, 'defaultTableOptions' => array()), $b, $d, array('enum' => 'string'));
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber($this->get('hatuey_soft.doctrine_subscriber.user_aware'));
     $c->addEventSubscriber($this->get('hatuey_soft.doctrine_subscriber.acl_aware'));
     $c->addEventSubscriber(new \FOS\UserBundle\Doctrine\Orm\UserListener($this));
     $c->addEventSubscriber($this->get('hatuey_soft.doctrine_subscriber.datetime_aware'));
     $c->addEventSubscriber($this->get('buseta_upload.doctrine_subscriber.upload_aware'));
     $c->addEventListener(array(0 => 'postPersist'), $this->get('doctrine.acl.listener'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => NULL, 'dbname' => 'sf_ticketsApp', 'user' => 'root', 'password' => 'root', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.switchfit_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_SwitchfitConnectionService()
 {
     $a = $this->get('annotation_reader');
     $b = new \Doctrine\DBAL\Logging\LoggerChain();
     $b->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $b->addLogger($this->get('doctrine.dbal.logger.profiling.switchfit'));
     $c = new \Doctrine\DBAL\Configuration();
     $c->setSQLLogger($b);
     $d = new \Gedmo\Timestampable\TimestampableListener();
     $d->setAnnotationReader($a);
     $e = new \Gedmo\Sluggable\SluggableListener();
     $e->setAnnotationReader($a);
     $f = new \Gedmo\Sortable\SortableListener();
     $f->setAnnotationReader($a);
     $g = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $g->addEventSubscriber($d);
     $g->addEventSubscriber($this->get('nordcode_translation.listener.translatable'));
     $g->addEventSubscriber($e);
     $g->addEventSubscriber($f);
     $g->addEventSubscriber($this->get('stof_doctrine_extensions.listener.translatable'));
     return $this->services['doctrine.dbal.switchfit_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_pgsql', 'dbname' => 'switchfit', 'user' => 'switchfit', 'host' => '127.0.0.1', 'port' => 5432, 'password' => 'switchfit', 'charset' => 'UTF', 'driverOptions' => array()), $c, $g, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine'), $this->get('debug.stopwatch')));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('dbname' => 'bewelcome', 'host' => 'localhost', 'port' => NULL, 'user' => 'bewelcome', 'password' => 'password', 'charset' => 'UTF8', 'driver' => 'pdo_mysql', 'driverOptions' => array()), $b, new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this), array());
 }
Esempio n. 20
0
        /** @var \Symfony\Component\EventDispatcher\EventDispatcher $eventDispatcher */
        $eventDispatcher = $container['event-dispatcher'];
        $eventDispatcher->dispatch(\Contao\Doctrine\DBAL\DoctrineDbalEvents::INITIALIZE_EVENT_MANAGER, $event);
    }
    return $eventManager;
});
$container['doctrine.connection.default'] = $container->share(function ($container) {
    // Register types
    foreach ($GLOBALS['DOCTRINE_TYPES'] as $name => $className) {
        \Doctrine\DBAL\Types\Type::addType($name, $className);
    }
    // reuse existing connection if the driver adapter is used
    if (strtolower($GLOBALS['TL_CONFIG']['dbDriver']) == 'doctrinemysql') {
        return \Database::getInstance()->getConnection();
    }
    $config = new \Doctrine\DBAL\Configuration();
    // set cache
    $cache = $container['doctrine.cache.default'];
    if ($cache) {
        $config->setResultCacheImpl($cache);
    }
    // build connection parameters
    $connectionParameters = array('dbname' => $GLOBALS['TL_CONFIG']['dbDatabase'], 'user' => $GLOBALS['TL_CONFIG']['dbUser'], 'password' => $GLOBALS['TL_CONFIG']['dbPass'], 'host' => $GLOBALS['TL_CONFIG']['dbHost'], 'port' => $GLOBALS['TL_CONFIG']['dbPort']);
    switch (strtolower($GLOBALS['TL_CONFIG']['dbDriver'])) {
        case 'mysql':
        case 'mysqli':
            $connectionParameters['driver'] = 'pdo_mysql';
            $connectionParameters['charset'] = $GLOBALS['TL_CONFIG']['dbCharset'];
            if (!empty($GLOBALS['TL_CONFIG']['dbSocket'])) {
                $connectionParameters['unix_socket'] = $GLOBALS['TL_CONFIG']['dbSocket'];
            }
Esempio n. 21
0
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger(new \Doctrine\DBAL\Logging\DebugStack());
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => NULL, 'dbname' => 'symfony', 'user' => 'root', 'password' => 'dupa1234', 'charset' => 'UTF8', 'driverOptions' => array()), $b, new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this), array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = $this->get('vich_uploader.metadata_reader');
     $b = $this->get('vich_uploader.upload_handler');
     $c = new \Doctrine\DBAL\Logging\LoggerChain();
     $c->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $c->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $d = new \Doctrine\DBAL\Configuration();
     $d->setSQLLogger($c);
     $e = new \Vich\UploaderBundle\Adapter\ORM\DoctrineORMAdapter();
     $f = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\CleanListener('product_image', $e, $a, $b));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\RemoveListener('product_image', $e, $a, $b));
     $f->addEventSubscriber($this->get('sonata.easy_extends.doctrine.mapper'));
     $f->addEventSubscriber(new \FOS\UserBundle\Doctrine\Orm\UserListener($this));
     $f->addEventSubscriber(new \Vich\UploaderBundle\EventListener\Doctrine\UploadListener('product_image', $e, $a, $b));
     $f->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'port' => NULL, 'dbname' => 'symfony', 'user' => 'root', 'password' => 'aungshine', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $d, $f, array());
 }
 /**
  * Gets the 'doctrine.dbal.site_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_SiteConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger($this->get('doctrine.dbal.logger'));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.site'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber($this->get('fos_user.user_listener'));
     return $this->services['doctrine.dbal.site_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '127.0.0.1', 'dbname' => 'siteaionrising', 'user' => 'root', 'password' => NULL, 'charset' => 'UTF8', 'port' => NULL, 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_pgsql', 'host' => 'localhost', 'port' => 5432, 'dbname' => 'bigbang', 'user' => 'ericlinberg', 'password' => '3m5am6u1', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $b, new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this), array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger($this->get('doctrine.dbal.logger'));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '192.168.123.22', 'port' => NULL, 'dbname' => 'realtime', 'user' => 'monty', 'password' => 'test1234', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection.configuration' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return Doctrine\DBAL\Configuration A Doctrine\DBAL\Configuration instance.
  */
 protected function getDoctrine_Dbal_DefaultConnection_ConfigurationService()
 {
     $this->services['doctrine.dbal.default_connection.configuration'] = $instance = new \Doctrine\DBAL\Configuration();
     $instance->setSQLLogger($this->get('doctrine.dbal.logger'));
     return $instance;
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Configuration();
     $a->setSQLLogger($this->get('doctrine.dbal.logger'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('dbname' => 'blog_db', 'host' => 'localhost', 'user' => 'root', 'password' => '', 'driver' => 'pdo_mysql', 'port' => NULL, 'driverOptions' => array()), $a, new \Doctrine\Common\EventManager());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger(new \Doctrine\DBAL\Logging\DebugStack());
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Gedmo\Sluggable\SluggableListener();
     $c->setAnnotationReader($this->get('annotation_reader'));
     $d = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $d->addEventSubscriber($c);
     $d->addEventSubscriber(new \FOS\UserBundle\Entity\UserListener($this));
     $d->addEventSubscriber($this->get('sonata.easy_extends.doctrine.mapper'));
     $d->addEventListener(array(0 => 'postPersist'), $this->get('lamadelray_platform.doctrine.notification'));
     $d->addEventListener(array(0 => 'postGenerateSchema'), 'security.acl.dbal.schema_listener');
     $d->addEventListener(array(0 => 'loadClassMetadata'), $this->get('doctrine.orm.default_listeners.attach_entity_listeners'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => 'sql4.freemysqlhosting.net', 'port' => 3306, 'dbname' => 'sql4102112', 'user' => 'sql4102112', 'password' => 'GjMYvtpwkb', 'charset' => 'UTF8', 'driverOptions' => array(), 'defaultTableOptions' => array()), $b, $d, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\DBAL\Connection A Doctrine\DBAL\Connection instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $c->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit('UTF8'));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'port' => '', 'dbname' => '', 'user' => 'root', 'password' => NULL, 'host' => 'localhost', 'driverOptions' => array()), $b, $c, array());
 }
 /**
  * Gets the 'doctrine.dbal.default_connection' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \stdClass A stdClass instance.
  */
 protected function getDoctrine_Dbal_DefaultConnectionService()
 {
     $a = new \Doctrine\DBAL\Logging\LoggerChain();
     $a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine', ContainerInterface::NULL_ON_INVALID_REFERENCE), $this->get('debug.stopwatch', ContainerInterface::NULL_ON_INVALID_REFERENCE)));
     $a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
     $b = new \Doctrine\DBAL\Configuration();
     $b->setSQLLogger($a);
     $c = new \Gedmo\Sluggable\SluggableListener();
     $c->setAnnotationReader($this->get('annotation_reader'));
     $d = new \Symfony\Bridge\Doctrine\ContainerAwareEventManager($this);
     $d->addEventSubscriber($c);
     $d->addEventSubscriber(new \FOS\UserBundle\Doctrine\Orm\UserListener($this));
     return $this->services['doctrine.dbal.default_connection'] = $this->get('doctrine.dbal.connection_factory')->createConnection(array('driver' => 'pdo_mysql', 'host' => '23125.m.tld.pl', 'port' => NULL, 'dbname' => 'baza23125_83', 'user' => 'admin23125_83', 'password' => '1QzX2h9TU7', 'charset' => 'UTF8', 'driverOptions' => array()), $b, $d, array());
 }