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


PHP District::setName方法代码示例

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


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

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // create connection to import database
     $this->logSection('connection', 'creating connection to import source');
     $source = Propel::getConnection($options['source'] ? $options['source'] : null);
     // create static counties and offices
     $this->logSection('static', 'creating static counties and offices');
     $connection->beginTransaction();
     try {
         OfficePeer::doDeleteAll($connection);
         $o1 = new Office();
         $o1->setName('Plattsburgh');
         $o1->save($connection);
         $o1 = new Office();
         $o1->setName('Rouses Point');
         $o1->save($connection);
         CountyPeer::doDeleteAll($connection);
         $c1 = new County();
         $c1->setName('Clinton');
         $c1->save($connection);
         $c1 = new County();
         $c1->setName('Essex');
         $c1->save($connection);
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // read in and create objects for district, frequency, icd9, job, services tables
     // DISTRICT
     $query = 'SELECT * FROM %s';
     $query = sprintf($query, 'tbl_district');
     $statement = $source->prepare($query);
     $statement->execute();
     $districts = $statement->fetchAll();
     $connection->beginTransaction();
     try {
         DistrictPeer::doDeleteAll($connection);
         foreach ($districts as $district) {
             $this->logSection('district', 'creating district ' . $district['district_name']);
             $d1 = new District();
             $d1->setName($district['district_name']);
             $d1->save($connection);
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // FREQUENCY
     $query = 'SELECT * FROM %s';
     $query = sprintf($query, 'tbl_frequency');
     $statement = $source->prepare($query);
     $statement->execute();
     $frequencies = $statement->fetchAll();
     $connection->beginTransaction();
     try {
         FrequencyPeer::doDeleteAll($connection);
         foreach ($frequencies as $freq) {
             $this->logSection('freq', 'reading frequency ' . $freq['freq_title']);
             $f1 = new Frequency();
             $f1->setName($freq['freq_title']);
             $f1->setDescription($freq['freq_description']);
             $f1->save($connection);
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // ICD9
     $query = 'SELECT * FROM %s';
     $query = sprintf($query, 'tbl_icd9');
     $statement = $source->prepare($query);
     $statement->execute();
     $icd9s = $statement->fetchAll();
     $connection->beginTransaction();
     try {
         Icd9Peer::doDeleteAll($connection);
         foreach ($icd9s as $icd9) {
             $this->logSection('icd9', 'reading icd9 ' . $icd9['icd9_value']);
             $i1 = new Icd9();
             $i1->setName($icd9['icd9_value']);
             $i1->save($connection);
         }
         $connection->commit();
     } catch (PropelException $e) {
         $connection->rollBack();
         throw $e;
     }
     // JOB
     $query = 'SELECT * FROM %s';
     $query = sprintf($query, 'tbl_job');
     $statement = $source->prepare($query);
     $statement->execute();
     $jobs = $statement->fetchAll();
     $connection->beginTransaction();
//.........这里部分代码省略.........
开发者ID:anvaya,项目名称:nckids,代码行数:101,代码来源:importTask.class.php


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