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


PHP Doctrine_Manager::getInstance方法代码示例

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


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

示例1: importSchema

 /**
  * importSchema
  *
  * A method to import a Schema and translate it into a Doctrine_Record object
  *
  * @param  string $schema       The file containing the XML schema
  * @param  string $format       Format of the schema file
  * @param  string $directory    The directory where the Doctrine_Record class will be written
  * @param  array  $models       Optional array of models to import
  *
  * @return void
  */
 public function importSchema($schema, $format = 'yml', $directory = null, $models = array())
 {
     $manager = Doctrine_Manager::getInstance();
     $modelLoading = $manager->getAttribute(Doctrine_Core::ATTR_MODEL_LOADING);
     $zendStyles = array(ZFDoctrine_Core::MODEL_LOADING_ZEND, ZFDoctrine_Core::MODEL_LOADING_ZEND_SINGLE_LIBRARY, ZFDoctrine_Core::MODEL_LOADING_ZEND_MODULE_LIBRARY);
     if (!in_array($modelLoading, $zendStyles)) {
         throw new ZFDoctrine_DoctrineException("Can't use ZFDoctrine_Schema with Doctrine_Core::ATTR_MODEL_LOADING not equal to 4 (Zend).");
     }
     $schema = (array) $schema;
     $records = $this->buildSchema($schema, $format);
     if (count($records) == 0) {
         throw new Doctrine_Import_Exception(sprintf('No records found for schema "' . $format . '" found in ' . implode(", ", $schema)));
     }
     $builder = $this->_getBuilder();
     $builder->setOptions($this->getOptions());
     $this->_initModules();
     foreach ($records as $name => $definition) {
         if (!empty($models) && !in_array($definition['className'], $models)) {
             continue;
         }
         $this->_buildRecord($builder, $definition);
     }
     if ($this->_listener) {
         $this->_listener->notifyImportCompleted();
     }
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:38,代码来源:Schema.php

示例2: read

 /**
  *
  * @return Doctrine_Schema
  * @access public
  */
 public function read()
 {
     $dataDict = Doctrine_Manager::getInstance()->getCurrentConnection()->getDataDict();
     $schema = new Doctrine_Schema();
     /* @todo FIXME i am incomplete*/
     $db = new Doctrine_Schema_Database();
     $schema->addDatabase($db);
     $dbName = 'XXtest';
     // @todo FIXME where should we get
     $this->conn->set("name", $dbName);
     $tableNames = $dataDict->listTables();
     foreach ($tableNames as $tableName) {
         $table = new Doctrine_Schema_Table();
         $table->set("name", $tableName);
         $tableColumns = $dataDict->listTableColumns($tableName);
         foreach ($tableColumns as $tableColumn) {
             $table->addColumn($tableColumn);
         }
         $this->conn->addTable($table);
         if ($fks = $dataDict->listTableConstraints($tableName)) {
             foreach ($fks as $fk) {
                 $relation = new Doctrine_Schema_Relation();
                 $relation->setRelationBetween($fk['referencingColumn'], $fk['referencedTable'], $fk['referencedColumn']);
                 $table->setRelation($relation);
             }
         }
     }
     return $schema;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:34,代码来源:Db.php

示例3: testTest

 public function testTest()
 {
     Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL);
     $user = new Ticket_DC187_User();
     $user->username = 'jwage';
     $user->email = 'jonwage@gmail.com';
     $user->password = 'changeme';
     $user->save();
     $user->delete();
     try {
         $user = new Ticket_DC187_User();
         $user->username = 'jwage';
         $user->email = 'jonwage@gmail.com';
         $user->password = 'changeme';
         $user->save();
         $this->pass();
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     try {
         $user = new Ticket_DC187_User();
         $user->username = 'jwage';
         $user->email = 'jonwage@gmail.com';
         $user->password = 'changeme';
         $user->save();
         $this->fail();
     } catch (Exception $e) {
         $this->pass();
     }
     Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_NONE);
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:31,代码来源:DC187TestCase.php

示例4: reset_

 public function reset_()
 {
     $facility_code = $this->session->userdata('facility_id');
     $reset_facility_transaction_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_transaction_table->execute("DELETE FROM `facility_transaction_table` WHERE  facility_code={$facility_code}; ");
     $reset_facility_stock_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_stock_table->execute("DELETE FROM `facility_stocks` WHERE  facility_code={$facility_code}");
     $reset_facility_issues_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_issues_table->execute("DELETE FROM `facility_issues` WHERE  facility_code={$facility_code};");
     $reset_facility_issues_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_issues_table->execute("DELETE FROM `redistribution_data` WHERE  source_facility_code={$facility_code} or receive_facility_code={$facility_code};");
     $facility_order_details_table = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAll("select id from `facility_orders` WHERE  facility_code={$facility_code};");
     foreach ($facility_order_details_table as $key => $value) {
         $reset_facility_order_table = Doctrine_Manager::getInstance()->getCurrentConnection();
         $reset_facility_order_table->execute("DELETE FROM `facility_order_details` WHERE  order_number_id={$value['id']}; ");
     }
     $reset_facility_order_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_order_table->execute("DELETE FROM `facility_orders` WHERE  facility_code={$facility_code}; ");
     $reset_facility_historical_stock_table = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_historical_stock_table->execute("DELETE FROM `facility_monthly_stock` WHERE  facility_code={$facility_code}; ");
     $reset_facility_update_stock_first_temp = Doctrine_Manager::getInstance()->getCurrentConnection();
     $reset_facility_update_stock_first_temp->execute("DELETE FROM `facility_stocks_temp` WHERE  facility_code={$facility_code}; ");
     $this->session->set_flashdata('system_success_message', 'Facility Stock Details Have Been Reset');
     redirect('home');
 }
开发者ID:karsanrichard,项目名称:hcmp_test,代码行数:25,代码来源:home.php

示例5: postUp

 public function postUp()
 {
     //Se crea la primera encuesta para el sitio
     $conn = Doctrine_Manager::getInstance()->connection();
     $query = 'INSERT INTO encuesta(id,nombre, created_at, updated_at) values(1,"Visita Oficina",now(), now())';
     $conn->execute($query);
 }
开发者ID:e-gob,项目名称:ChileAtiende,代码行数:7,代码来源:27.php

示例6: set_point

 public function set_point($facility_code, $service_point)
 {
     $update_points = Doctrine_Manager::getInstance()->getCurrentConnection();
     $sql = "INSERT INTO  `selected_service_points`(`facility_code`,`service_point_id`,`status`) VALUES ('{$facility_code}','{$service_point}','1')";
     $update_points->execute($sql);
     echo true;
 }
开发者ID:HCMPKenya,项目名称:hcmp_demo,代码行数:7,代码来源:settings.php

示例7: preExecute

 public function preExecute()
 {
     if (isset($_SESSION['username'])) {
         $this->redirect("http://ausw_travelagency_app.com/home/index");
     }
     $this->conn = Doctrine_Manager::getInstance()->connection();
 }
开发者ID:novesanchez,项目名称:project-travelagency,代码行数:7,代码来源:actions.class.php

示例8: buildDataTables

 /**
  * Build SQL Tables
  * 
  * @return type null
  */
 protected function buildDataTables()
 {
     try {
         $sqlPaths = $this->installData['dbscript_path'];
         if (!is_array($sqlPaths)) {
             $sqlPaths = array($sqlPaths);
         }
         $sqlString = '';
         foreach ($sqlPaths as $sqlPath) {
             $sqlString = $sqlString . file_get_contents(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . $this->installData['plugin_name'] . DIRECTORY_SEPARATOR . $sqlPath);
         }
         if (!empty($sqlString)) {
             $q = Doctrine_Manager::getInstance()->getCurrentConnection();
             $patterns = array();
             $patterns[0] = '/DELIMITER \\$\\$/';
             $patterns[1] = '/DELIMITER ;/';
             $patterns[2] = '/\\$\\$/';
             $new_sql_string = preg_replace($patterns, '', $sqlString);
             $result = $q->exec($new_sql_string);
             foreach ($sqlPaths as $value) {
                 $this->log('Execute ' . $value . " file");
             }
         }
     } catch (Exception $e) {
         throw new sfCommandException($e->getMessage());
     }
 }
开发者ID:abdocmd,项目名称:orangehrm-3.0.1,代码行数:32,代码来源:PluginInstaller.php

示例9: setTableDefinition

 public function setTableDefinition()
 {
     $conn = $this->getTable()->getConnection();
     if (!$conn) {
         $conn = Doctrine_Manager::getInstance()->getConnection(IcingaDoctrineDatabase::CONNECTION_ICINGA);
     }
     $prefix = $conn->getPrefix();
     $this->setTableName($prefix . 'servicechecks');
     $this->hasColumn('servicecheck_id', 'integer', 4, array('type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'autoincrement' => true));
     $this->hasColumn('instance_id', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('service_object_id', 'integer', 4, array('type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('check_type', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('current_check_attempt', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('max_check_attempts', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('state', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('state_type', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('start_time', 'timestamp', null, array('type' => 'timestamp', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0000-00-00 00:00:00', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('start_time_usec', 'integer', 4, array('type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('end_time', 'timestamp', null, array('type' => 'timestamp', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0000-00-00 00:00:00', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('end_time_usec', 'integer', 4, array('type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('command_object_id', 'integer', 4, array('type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('command_args', 'string', 255, array('type' => 'string', 'length' => 255, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('command_line', 'string', 1024, array('type' => 'string', 'length' => 1024, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('timeout', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('early_timeout', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('execution_time', 'float', null, array('type' => 'float', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('latency', 'float', null, array('type' => 'float', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('return_code', 'integer', 2, array('type' => 'integer', 'length' => 2, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('output', 'string', 255, array('type' => 'string', 'length' => 255, 'fixed' => false, 'unsigned' => false, 'primary' => false, 'default' => '', 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('long_output', 'string', null, array('type' => 'string', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false));
     $this->hasColumn('perfdata', 'string', null, array('type' => 'string', 'fixed' => false, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false));
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:32,代码来源:BaseIcingaServicechecks.php

示例10: preUp

 public function preUp()
 {
     parent::preUp();
     // get a mapping of current ids for later use
     $conn = Doctrine_Manager::getInstance()->connection();
     $episodes = $conn->execute('SELECT * FROM project_episodes')->fetchAll();
     $mapping = array();
     $afterDelete = array();
     foreach ($episodes as $episode) {
         if (empty($mapping[$episode['project_id'] . '-' . $episode['number'] . '-' . $episode['version']])) {
             $mapping[$episode['project_id'] . '-' . $episode['number'] . '-' . $episode['version']] = $episode['id'];
         } else {
             $afterDelete[] = $episode['id'];
         }
     }
     foreach ($episodes as $episode) {
         $rel = new Projects_Model_EpisodeRelease();
         $rel->vcodec = $episode['vcodec'];
         $rel->acodec = $episode['acodec'];
         $rel->container = $episode['container'];
         $rel->crc = $episode['crc'];
         $rel->released_at = $episode['released_at'];
         $rel->updated_by = $episode['updated_by'];
         $rel->created_at = $episode['created_at'];
         $rel->updated_at = $episode['updated_at'];
         $rel->episode_id = $mapping[$episode['project_id'] . '-' . $episode['number'] . '-' . $episode['version']];
         $rel->save();
         $rel->free();
     }
     Doctrine_Query::create()->delete('Projects_Model_Episode')->whereIn('id', $afterDelete)->execute();
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:31,代码来源:1310122738_version14.php

示例11: setUp

 public function setUp()
 {
     $manager = Doctrine_Manager::getInstance();
     $manager->registerConnectionDriver('test', 'Doctrine_Connection_Test');
     $this->_conn = $manager->openConnection('test://username:password@localhost/dbname', false);
     $this->_dbh = $this->_conn->getDbh();
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:7,代码来源:CustomTestCase.php

示例12: saveForm

 /**
  * @remotable
  * @formHandler
  */
 public function saveForm($a)
 {
     //capture the param 'staffList' and loop through the array of IDs
     //echo $a['staffList'];
     if (strlen($a['staffList'] > 0)) {
         $orgID = $this->getOrgID();
         $staff = $a['staffList'];
         $q = Doctrine_Manager::getInstance()->getCurrentConnection();
         $query = "UPDATE contact_value SET \r\n\t\t\t\t\t\t\tisRedFlag =  CASE \r\n\t\t\t\t\t\t\t\t\tWhen id in ({$staff})  \r\n\t\t\t\t\t\t\t\t\t\t THEN  1  \r\n\t\t\t\t\t\t\t\t\tElse 0\r\n\t\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t WHERE orgID={$orgID}";
         $result = $q->execute($query);
         //$q = Doctrine_Manager::getInstance()->getCurrentConnection();
         //$query = "UPDATE `contact_value` SET `isRedFlag` = '0' WHERE `orgID` = $orgID;";
         //$result = $q->execute($query);
         //$query = "UPDATE `contact_value` SET `isRedFlag` = '1' WHERE (`contact_value`.`ID` IN ($staff) AND `orgID` = $orgID);";
         //$result = $q->execute($query);
         //$q = Doctrine_Query::create()
         //->update('ContactValue')
         //->set('isRedFlag', 0)
         //->where('ID NOT IN (' . $a['staffList'] . ')')
         //->andWhere('orgID = '.$orgID.'');
         //$q->execute();
         //echo $q->getSqlQuery();
     }
     return parent::saveForm($a);
 }
开发者ID:unixmiah,项目名称:codeigniter-doctrine-extjs,代码行数:29,代码来源:RedFlagAPI.php

示例13: findOneByUser

 public function findOneByUser($nid, $uid)
 {
     $q = Doctrine_Manager::getInstance()->getConnectionForComponent('Quiz')->createQuery();
     $q->from('Quiz')->where('nid = ? AND uid = ?');
     $result = $q->execute(array($nid, $uid), Doctrine::HYDRATE_RECORD);
     return count($result) > 0 ? $result[0] : null;
 }
开发者ID:jkinner,项目名称:ringside,代码行数:7,代码来源:quiztable.class.php

示例14: execute

 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $conn = Doctrine_Manager::getInstance()->getCurrentConnection();
     $conn->beginTransaction();
     try {
         foreach ($arguments['filename'] as $filename) {
             $this->logSection('import', 'filename: ' . $filename);
             if ($fh = fopen($filename, 'r')) {
                 $op2Member = new Op2Member();
                 $op2Member->number = $this->getMemberIdFromFileName($filename);
                 $this->parse($fh, $conn, $op2Member);
                 fclose($fh);
             }
         }
         $jobs = Doctrine::getTable('ImportDiaryJob')->findAll();
         foreach ($jobs as $job) {
             $file = $job->File;
             $op2Member = $job->Op2Member;
             $this->logSection('import', 'started importing diaries of ' . $op2Member->Member->name);
             $this->logSection('import', 'filename: ' . $file->name);
             $op2Member->number = $this->getMemberIdFromFileName($file->original_filename);
             try {
                 $this->parse($file, $conn, $op2Member);
             } catch (Exception $e) {
             }
             $job->delete();
         }
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollBack();
         throw $e;
     }
 }
开发者ID:upsilon,项目名称:opMTViewerPlugin,代码行数:34,代码来源:opLogViewerImportDiaryTask.class.php

示例15: execute

 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     if (!$options['skip-build']) {
         $buildModel = new sfDoctrineBuildModelTask($this->dispatcher, $this->formatter);
         $buildModel->setCommandApplication($this->commandApplication);
         $buildModel->setConfiguration($this->configuration);
         $buildModel->run();
     }
     $connections = array();
     $models = $arguments['models'];
     foreach ($models as $key => $model) {
         $model = trim($model);
         $conn = Doctrine_Core::getTable($model)->getConnection();
         $connections[$conn->getName()][] = $model;
     }
     foreach ($connections as $name => $models) {
         $this->logSection('doctrine', 'dropping model tables for connection "' . $name . '"');
         $conn = Doctrine_Manager::getInstance()->getConnection($name);
         $models = $conn->unitOfWork->buildFlushTree($models);
         $models = array_reverse($models);
         foreach ($models as $model) {
             $tableName = Doctrine_Core::getTable($model)->getOption('tableName');
             $this->logSection('doctrine', 'dropping table "' . $tableName . '"');
             try {
                 $conn->export->dropTable($tableName);
             } catch (Exception $e) {
                 $this->logSection('doctrine', 'dropping table failed: ' . $e->getMessage());
             }
         }
         $this->logSection('doctrine', 'recreating tables for models');
         Doctrine_Core::createTablesFromArray($models);
     }
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:34,代码来源:sfDoctrineCreateModelTablesTask.class.php


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