本文整理汇总了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;
}
示例2: setCommented
public function setCommented(Doctrine_Record $toComment)
{
$this->setDefaults(array($this->getToward() . '_id' => $toComment->getId()));
}
示例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);
}
}
}