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


PHP Doctrine_Collection::getTable方法代码示例

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


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

示例1: _saveInCache

 /**
  * Save in cache
  *
  * @return void
  */
 private function _saveInCache(Zend_Cache_Core $cache)
 {
     $cacheData = array();
     $cacheData['tableName'] = $this->_dbData->getTable()->getComponentName();
     $cacheData['dataArray'] = $this->_dbData->toArray(self::SERIALIZATION_DEEP);
     $cache->save($cacheData, $this->_cacheKey);
 }
开发者ID:EricHogue,项目名称:Koryukan,代码行数:12,代码来源:Collection.php

示例2: testInsertMultiple

 public function testInsertMultiple()
 {
     $count = count($this->dbh);
     $listener = new Transaction_TestLogger();
     $users = new Doctrine_Collection('User');
     $users->getTable()->getConnection()->setListener($listener);
     $this->connection->beginTransaction();
     $users[0]->name = 'Arnold';
     $users[1]->name = 'Vincent';
     $users[0]->save();
     $users[1]->save();
     $this->assertEqual($listener->pop(), 'onSave');
     $this->assertEqual($listener->pop(), 'onInsert');
     $this->assertEqual($listener->pop(), 'onPreInsert');
     $this->assertEqual($listener->pop(), 'onPreSave');
     $this->assertEqual($listener->pop(), 'onSave');
     $this->assertEqual($listener->pop(), 'onInsert');
     $this->assertEqual($listener->pop(), 'onPreInsert');
     $this->assertEqual($listener->pop(), 'onPreSave');
     $this->assertEqual($users[0]->id, 2);
     $this->assertEqual($users[1]->id, 3);
     $this->assertTrue($count < count($this->dbh));
     $this->connection->commit();
     $this->assertEqual($listener->pop(), 'onTransactionCommit');
     $this->assertEqual($listener->pop(), 'onPreTransactionCommit');
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:26,代码来源:ConnectionTransactionTestCase.php

示例3: getObjects

 public function getObjects()
 {
     $objects = parent::getObjects();
     if ($objects instanceof Doctrine_Record) {
         $objects = new Doctrine_Collection($objects->getTable());
     }
     return $objects;
 }
开发者ID:broschb,项目名称:cyclebrain,代码行数:8,代码来源:sfDoctrineRoute.class.php

示例4: _buildObjects

 /**
  * Remaps a doctrine collection so that the keys of the colleciton "array"
  * are the ids of the underlying objects. This makes the collection
  * easier to deal with then replacing objects
  * 
  * @return Doctrine_Collection
  */
 protected static function _buildObjects(Doctrine_Collection $collection)
 {
     $objects = new Doctrine_Collection($collection->getTable());
     foreach ($collection as $key => $value) {
         $objects[$value->slug] = $value;
     }
     return $objects;
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:15,代码来源:sfSympalContentSyntaxReplacer.class.php

示例5: _setTable

 /**
  * @param Doctrine_Record|Doctrine_Collection|Array $data
  * @param null|Doctrine_Table $table
  * @return Kebab_Validate_Doctrine_Table
  */
 protected function _setTable($data, $table = null)
 {
     if (is_null($table) && $data instanceof Doctrine_Record) {
         $this->_table = $data->getTable();
     }
     if (!is_null($table) && $table instanceof Doctrine_Table) {
         $this->_table = $table;
     }
     if (is_string($table) && !$table instanceof Doctrine_Table) {
         $this->_table = Doctrine_Core::getTable($table);
     }
     return $this;
 }
开发者ID:esironal,项目名称:kebab-project,代码行数:18,代码来源:DoctrineTable.php

示例6: merge

 /**
  * Merges collection into $this and returns merged collection
  * 
  * @param Doctrine_Collection $coll
  * @return Doctrine_Collection
  */
 public function merge(Doctrine_Collection $coll)
 {
     $localBase = $this->getTable()->getComponentName();
     $otherBase = $coll->getTable()->getComponentName();
     if ($otherBase != $localBase && !is_subclass_of($otherBase, $localBase)) {
         throw new Doctrine_Collection_Exception("Can't merge collections with incompatible record types");
     }
     foreach ($coll->getData() as $record) {
         $this->add($record);
     }
     return $this;
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:18,代码来源:Collection.php

示例7: getCollectionAsXml

 /**
  * Return an collection of records as XML. 
  * 
  * @see getRecordAsXml for options to set in the record class to control this.
  *
  * @param Doctrine_Collection $collection
  * @param SimpleXMLElement $xml
  * @return string Xml as string 
  */
 public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null)
 {
     $collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName);
     if ($collection->count != 0) {
         $record = $collection[0];
         $xml_options = $record->option("xml");
         if (isset($xml_options["collection_name"])) {
             $collectionName = $xml_options["collection_name"];
         }
     }
     if (!isset($incomming_xml)) {
         $new_xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><" . $collectionName . "></" . $collectionName . ">";
         $xml = new SimpleXMLElement($new_xml_string);
     } else {
         $xml = $incomming_xml->addChild($collectionName);
     }
     foreach ($collection as $key => $record) {
         Doctrine_Lib::getRecordAsXml($record, $xml);
     }
     return $xml->asXML();
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:30,代码来源:Lib.php


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