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


PHP Criteria::setDistinct方法代码示例

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


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

示例1: _getItemsPKsVotedByUsers

 protected static function _getItemsPKsVotedByUsers($users_pks, $voting_attitude = null, $model = null)
 {
     $c = new Criteria();
     $c->setDistinct();
     $c->clearSelectColumns();
     $c->addSelectColumn(self::VOTABLE_ID);
     // analyze voting attitude
     if (!is_null($voting_attitude)) {
         if ($voting_attitude > 0) {
             $c->add(self::VOTING, 0, Criteria::GREATER_THAN);
         } elseif ($voting_attitude < 0) {
             $c->add(self::VOTING, 0, Criteria::LESS_THAN);
         } else {
             $c->add(self::VOTING, 0);
         }
     }
     $c->add(self::USER_ID, $users_pks, Criteria::IN);
     if (!is_null($model)) {
         $c->add(self::VOTABLE_MODEL, $model);
     }
     $rs = self::doSelectRS($c);
     $pks = array();
     while ($rs->next()) {
         $pks[] = $rs->getInt(1);
     }
     return $pks;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:27,代码来源:sfVotingPeer.php

示例2: getAllGroups

 /**
  * returns the groups in the given ramo (and for the given legislatura) and include the zero value, if given
  *
  * @param string $ramo 
  * @param int    $legislatura
  * @param string $include_zero 
  * @return an associative array, with id and name as key => value
  * @author Guglielmo Celata
  */
 public static function getAllGroups($ramo, $legislatura, $include_zero = false)
 {
     $c = new Criteria();
     if ($ramo == 'camera') {
         $c->add(OppCaricaPeer::TIPO_CARICA_ID, 1);
     } else {
         $c->add(OppCaricaPeer::TIPO_CARICA_ID, array(4, 5), Criteria::IN);
     }
     $c->addJoin(OppGruppoPeer::ID, OppCaricaHasGruppoPeer::GRUPPO_ID);
     $c->addJoin(OppCaricaPeer::ID, OppCaricaHasGruppoPeer::CARICA_ID);
     $c_or_leg = $c->getNewCriterion(OppCaricaPeer::LEGISLATURA, $legislatura);
     $c_or_leg->addOr($c->getNewCriterion(OppCaricaPeer::LEGISLATURA, null, Criteria::ISNULL));
     $c->add($c_or_leg);
     $c->clearSelectColumns();
     $c->addSelectColumn(OppGruppoPeer::ID);
     $c->addSelectColumn(OppGruppoPeer::NOME);
     $c->setDistinct();
     $rs = OppGruppoPeer::doSelectRS($c);
     if ($include_zero) {
         $all_groups = array('0' => $include_zero);
     } else {
         $all_groups = array();
     }
     while ($rs->next()) {
         $all_groups[$rs->getInt(1)] = $rs->getString(2);
     }
     return $all_groups;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:37,代码来源:OppGruppoPeer.php

示例3: query

 /**
  * Executes query and hydrate this object
  *
  * @param       string $query the query being searched for
  */
 public function query($query, PropelPDO $propelConnection = null)
 {
     $refQuery = trim($query);
     if (strlen($refQuery) < 3) {
         throw new Exception("Too few characters in the query string");
     } elseif (helperFunctions::isMaliciousString($refQuery)) {
         throw new Exception("Malicious string detected. Are you trying to wreck our system?");
     } else {
         // search for courses
         $c = new Criteria();
         $idCrit = $c->getNewCriterion(CoursePeer::ID, $refQuery . "%", Criteria::LIKE);
         $nameCrit = $c->getNewCriterion(CoursePeer::DESCR, "%" . $refQuery . "%", Criteria::LIKE);
         $idCrit->addOr($nameCrit);
         $c->addAnd($idCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(CoursePeer::ID);
         $this->_courseList = CoursePeer::doselect($c, $propelConnection);
         // search for professors
         $c = new Criteria();
         $firstNameCrit = $c->getNewCriterion(InstructorPeer::FIRST_NAME, "%" . $refQuery . "%", Criteria::LIKE);
         $lastNameCrit = $c->getNewCriterion(InstructorPeer::LAST_NAME, "%" . $refQuery . "%", Criteria::LIKE);
         $firstNameCrit->addOr($lastNameCrit);
         $c->addAnd($firstNameCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(InstructorPeer::LAST_NAME);
         $this->_profList = InstructorPeer::doSelect($c, $propelConnection);
         // search for programs
         $c = new Criteria();
         $descrCrit = $c->getNewCriterion(DisciplinePeer::DESCR, "%" . $refQuery . "%", Criteria::LIKE);
         $c->addAnd($descrCrit);
         $c->setDistinct();
         $c->addAscendingOrderByColumn(DisciplinePeer::DESCR);
         $this->_programList = DisciplinePeer::doSelect($c, $propelConnection);
     }
 }
开发者ID:rafd,项目名称:SkuleCourses,代码行数:40,代码来源:fuzzySearch.class.php

示例4: getWithJobs

 public static function getWithJobs()
 {
     $criteria = new Criteria();
     $criteria->addJoin(self::ID, JobeetJobPeer::CATEGORY_ID);
     $criteria->add(JobeetJobPeer::EXPIRES_AT, time(), Criteria::GREATER_THAN);
     $criteria->setDistinct();
     return self::doSelect($criteria);
 }
开发者ID:rdi0r,项目名称:dreamrc,代码行数:8,代码来源:JobeetCategoryPeer.php

示例5: getWithMailboxs

 public static function getWithMailboxs()
 {
     $criteria = new Criteria();
     $criteria->addJoin(self::ID, GcMailboxPeer::GROUP_ID);
     $criteria->add(GcMailboxPeer::EXPIRES_AT, time(), Criteria::GREATER_THAN);
     $criteria->setDistinct();
     return self::doSelect($criteria);
 }
开发者ID:rafix,项目名称:gesCorreo,代码行数:8,代码来源:GcGroupPeer.php

示例6: getUsedCategories

 public static function getUsedCategories()
 {
     $c = new Criteria();
     $c->addJoin(self::ID, PcBlogCategoriesPostsPeer::CATEGORY_ID, Criteria::INNER_JOIN);
     $c->addJoin(PcBlogCategoriesPostsPeer::POST_ID, PcBlogPostPeer::ID, Criteria::INNER_JOIN);
     $c->setDistinct();
     return self::doSelect($c);
 }
开发者ID:ntemple,项目名称:intelli-plancake,代码行数:8,代码来源:PcBlogCategoryPeer.php

示例7: getAllDistinctRouteId

 /**
  * 
  * @return Routes2011[]
  */
 public static function getAllDistinctRouteId()
 {
     $criteria = new Criteria();
     $criteria->addAscendingOrderByColumn(self::ROUTEID);
     $criteria->setDistinct();
     $criteria->clearSelectColumns();
     $criteria->addSelectColumn(self::ROUTEID);
     return self::doSelect($criteria);
 }
开发者ID:ntuaha,项目名称:SimpleBusServer,代码行数:13,代码来源:Routes2011Peer.php

示例8: findCoursesByInstructorId

 /**
  * Fetches a list of Course objects
  *
  * @param       int $instructorId ID of instructor object
  * @return      A list of course objects
  */
 public static function findCoursesByInstructorId($instructorId, PropelPDO $propelConnection = null)
 {
     $c = new Criteria();
     $c->addJoin(CoursePeer::ID, CourseInstructorAssociationPeer::COURSE_ID);
     $c->add(CourseInstructorAssociationPeer::INSTRUCTOR_ID, $instructorId);
     $c->setDistinct();
     $c->addAscendingOrderByColumn(CoursePeer::ID);
     return CoursePeer::doselect($c, $propelConnection);
 }
开发者ID:rafd,项目名称:SkuleCourses,代码行数:15,代码来源:CoursePeer.php

示例9: retrieveForCourseCriteria

 /**
  * This static method retrieves all the subjects for a course.
  *
  * @param Course $course
  * @return Criteria
  */
 public static function retrieveForCourseCriteria(Course $course)
 {
     $c = new Criteria();
     $c->add(CourseSubjectPeer::COURSE_ID, $course->getId());
     $c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID, CareerSubjectPeer::ID, Criteria::INNER_JOIN);
     $c->addJoin(CareerSubjectPeer::SUBJECT_ID, self::ID, Criteria::INNER_JOIN);
     $c->setDistinct();
     return $c;
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:16,代码来源:SubjectPeer.php

示例10: joinWithDivisions

 /**
  * This method joins to the divisions of the teacher
  * @param Criteria $c
  * @param <type> $user_id
  */
 public static function joinWithDivisions(Criteria $criteria, $user_id)
 {
     $criteria->setDistinct(DivisionPeer::ID);
     $criteria->addJoin(DivisionPeer::ID, CoursePeer::DIVISION_ID);
     $criteria->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID);
     $criteria->addJoin(CourseSubjectPeer::ID, CourseSubjectTeacherPeer::COURSE_SUBJECT_ID);
     $criteria->addJoin(CourseSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
     $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
     $criteria->add(PersonPeer::USER_ID, $user_id);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:15,代码来源:TeacherPeer.php

示例11: getOrientations

 public static function getOrientations($widget, $value)
 {
     $career = CareerPeer::retrieveByPk($value);
     $orientations = array('' => '');
     $c = new Criteria();
     $c->setDistinct();
     foreach ($career->getOrientations($c) as $orientation) {
         $orientations[$orientation->getId()] = $orientation->__toString();
     }
     $widget->setOption("choices", $orientations);
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:11,代码来源:StudentOrientationForm.class.php

示例12: retrieveAllValuesForColumn

  /**
   * Get all the different values set to $column.
   *
   * @param  string    $column The column from this class' table.
   * @param  PropelPDO $con    Optional PDO object.
   * @return array
   */
  static public function retrieveAllValuesForColumn($column, PropelPDO $con = null)
  {
    $criteria = new Criteria();

    $criteria->setDistinct();
    $criteria->clearSelectColumns();
    $criteria->addSelectColumn($column);

    return ncTrackerEntryPeer::doSelectStmt($criteria)
      ->fetchAll(PDO::FETCH_COLUMN);
  }
开发者ID:ncuesta,项目名称:ncTrackerPlugin,代码行数:18,代码来源:ncTrackerEntryPeer.php

示例13: addIdentificationNumberColumnCriteria

 public function addIdentificationNumberColumnCriteria(Criteria $criteria, $field, $value)
 {
     $value = trim($value);
     if ($value != '') {
         $value = "%{$value}%";
         $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
         $criterion = $criteria->getNewCriterion(PersonPeer::IDENTIFICATION_NUMBER, $value, Criteria::LIKE);
         $criteria->add($criterion);
         $criteria->setDistinct();
     }
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:11,代码来源:TeacherFormFilter.class.php

示例14: prepareResult

 /**
  * @return \ResultSet
  * @throws \PropelException
  */
 protected function prepareResult()
 {
     $p = $this->getPeer();
     $criteria = new \Criteria();
     $criteria->setDistinct();
     $criteria->addAscendingOrderByColumn($this->getFullyQualifiedPKName($p));
     $this->logger->debug("Propel\\Source calling ...::createResultSet()");
     $r = $this->createResultSet($p, $criteria);
     $this->logger->debug("...::createResultSet() returned");
     return $r;
 }
开发者ID:webfactory,项目名称:content-mapping-sourceadapter-propel,代码行数:15,代码来源:PropelSourceAdapter.php

示例15: testCreateSelectSqlPartSelectModifier

 public function testCreateSelectSqlPartSelectModifier()
 {
     $db = Propel::getDB(BookPeer::DATABASE_NAME);
     $c = new Criteria();
     $c->addSelectColumn(BookPeer::ID);
     $c->addAsColumn('book_ID', BookPeer::ID);
     $c->setDistinct();
     $fromClause = array();
     $selectSql = $db->createSelectSqlPart($c, $fromClause);
     $this->assertEquals('SELECT DISTINCT book.ID, book.ID AS book_ID', $selectSql, 'createSelectSqlPart() includes the select modifiers in the SELECT clause');
     $this->assertEquals(array('book'), $fromClause, 'createSelectSqlPart() adds the tables from the select columns to the from clause');
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:12,代码来源:DBAdapterTest.php


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