當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Record::getId方法代碼示例

本文整理匯總了PHP中Doctrine_Record::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Record::getId方法的具體用法?PHP Doctrine_Record::getId怎麽用?PHP Doctrine_Record::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine_Record的用法示例。


在下文中一共展示了Doctrine_Record::getId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFor

 public static function getFor(Doctrine_Record $object)
 {
     $tableName = $object->getTable()->getTableName();
     $componentName = $object->getTable()->getComponentName();
     $q = Doctrine_Query::create()->select('c.message, c.parent, c.created_at, c.updated_at, c.created_by, c.updated_by, p.*, v.*,u.*')->from('Comment' . $componentName . ' c')->leftJoin('c.CreatedBy p')->leftJoin('p.User u')->leftJoin('c.VoteComment v')->where('c.' . $tableName . '_id = ?', $object->getId());
     $treeObject = Doctrine::getTable('Comment' . $componentName)->getTree();
     $treeObject->setBaseQuery($q);
     $comments = array();
     $rootComment = $treeObject->fetchRoots()->getFirst();
     if ($rootComment) {
         foreach ($treeObject->fetchTree(array('root_id' => $rootComment->root_id)) as $comment) {
             $comments[] = $comment;
         }
     }
     array_shift($comments);
     return $comments;
 }
開發者ID:limitium,項目名稱:uberlov,代碼行數:17,代碼來源:Comment.class.php

示例2: setCommented

 public function setCommented(Doctrine_Record $toComment)
 {
     $this->setDefaults(array($this->getToward() . '_id' => $toComment->getId()));
 }
開發者ID:limitium,項目名稱:uberlov,代碼行數:4,代碼來源:CommentForm.class.php

示例3: deleteFromLuceneIndex

 public static function deleteFromLuceneIndex(Doctrine_Record $object, $culture = null)
 {
     $index = $object->getTable()->getLuceneIndex();
     // remove an existing entry
     $id = $object->getId();
     // 20090506: we can't use a regular query string here because
     // numbers (such as IDs) will get stripped from it. So we have
     // to build a query using the Zend Search API. Note that this means
     // the Jobeet sample code is incorrect.
     // http://framework.zend.com/manual/en/zend.search.lucene.searching.html#zend.search.lucene.searching.query_building
     $aTerm = new Zend_Search_Lucene_Index_Term($id, 'primarykey');
     $aQuery = new Zend_Search_Lucene_Search_Query_Term($aTerm);
     $query = new Zend_Search_Lucene_Search_Query_Boolean();
     $query->addSubquery($aQuery, true);
     if (!is_null($culture)) {
         $culture = self::normalizeCulture($culture);
         $cultureTerm = new Zend_Search_Lucene_Index_Term($culture, 'culture');
         // Oops, this said $aTerm before. Thanks to Quentin Dugauthier
         $cultureQuery = new Zend_Search_Lucene_Search_Query_Term($cultureTerm);
         $query->addSubquery($cultureQuery, true);
     }
     if ($hits = $index->find($query)) {
         // id is correct. This is the internal Zend search index id which is
         // not the same thing as the id of our object.
         // There should actually be only one hit for a specific id and culture
         foreach ($hits as $hit) {
             $index->delete($hit->id);
         }
     }
 }
開發者ID:verenate,項目名稱:gri,代碼行數:30,代碼來源:aZendSearch.class.php


注:本文中的Doctrine_Record::getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。