本文整理汇总了PHP中Criteria::addGroupByColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addGroupByColumn方法的具体用法?PHP Criteria::addGroupByColumn怎么用?PHP Criteria::addGroupByColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::addGroupByColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfigs
public function getConfigs()
{
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn('MAX(' . SchedulerConfigPeer::ID . ')');
$c->addGroupByColumn(SchedulerConfigPeer::VARIABLE);
$c->addGroupByColumn(SchedulerConfigPeer::VARIABLE_PART);
$c->addAscendingOrderByColumn(SchedulerConfigPeer::VARIABLE);
$c->add(SchedulerConfigPeer::SCHEDULER_ID, $this->id);
$c->add(SchedulerConfigPeer::WORKER_ID, null);
$rs = SchedulerConfigPeer::doSelectStmt($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
$configIds = $rs->fetchAll(PDO::FETCH_COLUMN, 0);
return SchedulerConfigPeer::retrieveByPKs($configIds, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
}
示例2: renderFieldCategory
protected function renderFieldCategory(ConfigFieldCategory $fieldCategory)
{
$str = "";
$fields = $fieldCategory->getConfigFields();
foreach ($fields as $field) {
$str .= "<fieldset>";
$str .= "<legend>" . $field->getName() . "</legend>";
$fieldId = $field->getId();
$cField = new Criteria();
$cField->add(FieldValuePeer::FIELD_ID, $fieldId);
/*$c1 = $cField->getNewCriterion(FieldValuePeer::VALUE, $query.'%', Criteria::LIKE);
$c2 = $cField->getNewCriterion(FieldValuePeer::VALUE, "", Criteria::NOT_EQUAL);
$c1->addAnd($c2);
$cField->addAnd($c1);*/
$cField->add(FieldValuePeer::VALUE, "", Criteria::NOT_EQUAL);
$cField->addGroupByColumn(FieldValuePeer::VALUE);
$cField->addAscendingOrderByColumn(FieldValuePeer::VALUE);
$cField->setLimit(15);
$values = FieldValuePeer::doSelect($cField);
$valueIndex = 0;
foreach ($values as $value) {
$str .= "<label>" . $value->getValue() . "</label>";
$str .= "<input type=\"checkbox\" name=\"fields[" . $field->getId() . "][{$valueIndex}]\" id=\"fields_" . $field->getId() . "_{$valueIndex}\" value=\"" . $value->getValue() . "\" /><br>";
$valueIndex++;
}
$str .= "</fieldset>";
}
return $str;
}
示例3: getMakeoverEntries
public static function getMakeoverEntries($subp_id, $puser_id, $puser_ids)
{
$c = new Criteria();
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
$c->add(entryPeer::STATUS, entryStatus::READY);
$c->addSelectColumn("MAX(" . entryPeer::ID . ")");
$c->addSelectColumn(PuserRolePeer::PUSER_ID);
$c->addGroupByColumn(PuserRolePeer::KSHOW_ID);
$c->addJoin(entryPeer::KSHOW_ID, PuserRolePeer::KSHOW_ID);
$c->add(PuserRolePeer::SUBP_ID, $subp_id);
$c->add(PuserRolePeer::ROLE, PuserRole::PUSER_ROLE_RECIPIENT);
$c->add(PuserRolePeer::PUSER_ID, explode(",", $puser_ids . ',' . $puser_id), Criteria::IN);
$rs = entryPeer::doSelectStmt($c);
$entry_ids = array();
$entry_puser_ids = array();
$res = $rs->fetchAll();
foreach ($res as $record) {
$entry_ids[] = $record[0];
$entry_puser_ids[] = $record[1];
}
// // old code from doSelectRs
// while($rs->next())
// {
// $entry_ids[] = $rs->getInt(1);
// $entry_puser_ids[] = $rs->getString(2);
// }
return array($entry_ids, $entry_puser_ids);
}
示例4: getEquipmentMileage
public static function getEquipmentMileage($userId, $bikeId)
{
$c = new Criteria();
$c->clearSelectColumns();
$c->addSelectColumn('SUM(' . UserStatsPeer::MILEAGE . ')');
$c->addSelectColumn(UserEquipementPeer::EQUIPMENT_ID);
//$c->addGroupByColumn(UserRidesPeer::MILEAGE);
$c->add(UserEquipementPeer::USER_ID, $userId);
$c->add(UserEquipementPeer::BIKE_ID, $bikeId);
$c->addJoin(UserEquipementPeer::EQUIPMENT_ID, UserStatEquipPeer::USER_EQUIP_ID, Criteria::INNER_JOIN);
$c->addJoin(UserStatEquipPeer::USER_STAT_ID, UserStatsPeer::STAT_NO, Criteria::INNER_JOIN);
//$c->addJoin(UserStatsPeer::RIDE_KEY,UserRidesPeer::USER_RIDE_ID, Criteria::INNER_JOIN);
$c->addGroupByColumn(UserEquipementPeer::EQUIPMENT_ID);
$stmt = UserStatsPeer::doSelectStmt($c);
$hashmap = array();
if ($stmt) {
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
if ($row) {
$sum = $row[0];
$eqId = $row[1];
//echo 'Mil '.$sum.' '.$eqId;
$hashmap[$eqId] = $sum;
// array_push($hashmap, $eqId=>$sum);
}
}
}
return $hashmap;
}
示例5: getKshowRoughcutCount
public static function getKshowRoughcutCount(array $kuser_id_list)
{
$c = new Criteria();
$c->add(entryPeer::TYPE, entryType::MIX);
$c->add(entryPeer::KSHOW_ID, $kuser_id_list, Criteria::IN);
$c->addSelectColumn(entryPeer::KSHOW_ID);
$c->addAsColumn('cnt', 'COUNT(' . entryPeer::KSHOW_ID . ')');
$c->addGroupByColumn(entryPeer::KSHOW_ID);
$rs = entryPeer::doSelectStmt($c);
$kusers_roughcuts = array();
$res = $rs->fetchAll();
foreach ($res as $record) {
$id = $record[0];
$cnt = $record[1];
$kusers_roughcuts[$id] = $cnt;
}
// // old code from doSelectRs
// while($rs->next())
// {
// $id= $rs->getInt(1);
// $cnt = $rs->getInt(2);
// $kusers_roughcuts[$id]=$cnt;
// }
$rs->close();
return $kusers_roughcuts;
}
示例6: commit
/**
* Commits changes (increases serial by 1)
*
* @return Array on success, string on error
*/
public static function commit()
{
// do some checks first
$pdns_version = trim(shell_exec("sudo /usr/bin/pdns_control version 2>&1"));
if (!preg_match('/^[0-9,\\.]+$/', $pdns_version)) {
if (preg_match('/\\[sudo\\] password/', $pdns_version)) {
return "Unable to run 'sudo /usr/bin/pdns_control'. Is it defined in sudoers file?";
} else {
return $pdns_version;
}
}
$commited = array();
$c = new Criteria();
$c->add(AuditPeer::OBJECT, 'Record');
$c->addGroupByColumn(AuditPeer::DOMAIN_ID);
$c->add(AuditPeer::CREATED_AT, date("Y-m-d H:i:s", MyTools::getLastCommit()), Criteria::GREATER_THAN);
foreach (AuditPeer::doSelect($c) as $audit) {
$domain = DomainPeer::retrieveByPK($audit->getDomainId());
$commited[] = $domain->getName();
// get SOA record
$c = new Criteria();
$c->add(RecordPeer::DOMAIN_ID, $domain->getId());
$c->add(RecordPeer::TYPE, 'SOA');
$SOA = RecordPeer::doSelectOne($c);
$temp = explode(" ", $SOA->getContent());
$serial = $temp[2];
$date = substr($serial, 0, 8);
$id = substr($serial, 8);
// today ?
if ($date == date("Ymd")) {
$id++;
if (strlen($id) == 1) {
$id = "0" . $id;
}
$serial = $date . $id;
} else {
$serial = date("Ymd") . "01";
}
if ($serial >= 4294967295) {
continue;
}
// don't allow >= 32bit unsigned
$SOA->setContent(implode(" ", array($temp[0], $temp[1], $serial)));
$SOA->save();
}
if ($commited) {
SettingPeer::setValue('last_commit', time());
sleep(2);
if ($also_notify = sfConfig::get('app_default_also-notify')) {
foreach ($commited as $domain) {
foreach ($also_notify as $host) {
exec("sudo /usr/bin/pdns_control notify-host {$domain} {$host}");
}
}
}
}
return $commited;
}
示例7: getLlistesMissatge
/**
* Retorna les llistes relacionades amb un missatge
* @param $idM idMissatge
* @return Select LlistesLlistes
* */
public static function getLlistesMissatge($idM)
{
$C = new Criteria();
$C->add(self::ACTIU, true);
$C->addJoin(LlistesLlistesMissatgesPeer::IDLLISTA, self::IDLLISTA);
$C->add(LlistesLlistesMissatgesPeer::IDMISSATGE, $idM);
$C->add(LlistesLlistesMissatgesPeer::ACTIU, true);
$C->addGroupByColumn(self::IDLLISTA);
return self::doSelect($C);
}
示例8: executeListarPorCategoria
public function executeListarPorCategoria(sfWebRequest $requets)
{
$cat = $requets->getParameter('id');
$nomCat = CategoriaQuery::create();
$nomCat->filterById($cat);
$this->categoria = $nomCat->findOne();
//logica de negocio: no_autenticados o menores NO xxx
if ($cat == 8) {
if (!$this->getUser()->isAuthenticated()) {
$this->mje = "Usted no esta logueado, no puede acceder a esta sección!";
return sfView::ERROR;
} else {
$edad = $this->getUser()->getAttribute('edad');
if ($edad < 18) {
$this->mje = "Usted es menor de edad y no puede acceder a esta sección!";
return sfView::ERROR;
}
}
}
//10 es el numero de registros que deseo mostrar
$paginacion = new sfPropelPager('Pelicula', 10);
$sql = new Criteria();
$sql->add(PeliculaPeer::CATEGORIA_ID, $cat, Criteria::EQUAL);
$sql->addAscendingOrderByColumn(PeliculaPeer::TITULO);
$sql->addGroupByColumn(PeliculaPeer::TITULO);
$paginacion->setCriteria($sql);
$paginacion->setPage($this->getRequestParameter('pag', 1));
$paginacion->init();
$this->peliculas = $paginacion;
/*$cat = $requets->getParameter('id');
$nomCat = CategoriaQuery::create();
$nomCat->filterById($cat);
$this->categoria = $nomCat->findOne();
if ($cat == 8){
if(!$this->getUser()->isAuthenticated()){
$this->mje = "Usted no esta logueado, no puede acceder a esta sección!";
return sfView::ERROR;
}else{
$edad = $this->getUser()->getAttribute('edad');
if($edad < 18){
$this->mje = "Usted es menor de edad y no puede acceder a esta sección!";
return sfView::ERROR;
}
}
}
$this->peliculas = PeliculaQuery::create()
->filterByEstado('1')
->filterByCategoriaId($cat)
->groupByTitulo()
->find();
*
*/
}
示例9: retrieveForExamination
/**
* Returns CareerSubjectSchoolYears for a given examination
*
* @param Examination $examination
* @param PropelPDO $con
* @return CareerSubjectSchoolYear[]
*/
public static function retrieveForExamination(Examination $examination, PropelPDO $con)
{
$con = is_null($con) ? Propel::getConnection() : $con;
$c = new Criteria();
$c->addJoin(CourseSubjectStudentExaminationPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID);
$c->addJoin(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, CourseSubjectPeer::ID);
$c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, self::ID);
$c->addJoin(self::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID);
$c->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $examination->getSchoolYearId());
$c->add(CourseSubjectStudentExaminationPeer::EXAMINATION_NUMBER, $examination->getExaminationNumber());
$c->addGroupByColumn(self::ID);
return self::doSelect($c, $con);
}
示例10: stringData
public function stringData()
{
$oCriteria = new Criteria();
$oCriteria->addGroupByColumn(TranslationPeer::STRING_KEY);
$oCriteria->add(TranslationPeer::STRING_KEY, $this->sStringId);
$oString = TranslationPeer::doSelectOne($oCriteria);
if ($oString === null) {
$oString = new Translation();
}
$aResult = $oString->toArray();
$aResult['CreatedInfo'] = Util::formatCreatedInfo($oString);
$aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oString);
return $aResult;
}
示例11: getTagsWithCount
public static function getTagsWithCount()
{
$c = new Criteria();
$c->clearSelectColumns()->clearOrderByColumns();
$c->addSelectColumn(self::TAG);
$c->addSelectColumn('count(' . self::SF_BLOG_POST_ID . ') as count');
$c->addGroupByColumn(self::TAG);
$rs = self::doSelectRS($c);
$tags = array();
while ($rs->next()) {
$tags[] = array($rs->getString(1), $rs->getInt(2));
}
return $tags;
}
示例12: CriteriaEmailsFromLlistes
private static function CriteriaEmailsFromLlistes($A_llistes, $all = false)
{
$C = new Criteria();
if (!$all) {
$C->add(self::ACTIU, true);
}
$C->add(self::IDLLISTA, $A_llistes, CRITERIA::IN);
$C->addJoin(LlistesEmailsPeer::IDEMAIL, self::IDEMAIL);
$C->add(LlistesEmailsPeer::ACTIU, true);
//Si està de baixa global, ho haurà d'informar a informatica
$C->addGroupByColumn(self::IDEMAIL);
$C->addAscendingOrderByColumn(LlistesEmailsPeer::EMAIL);
return $C;
}
示例13: retrieveCriteriaByCareerSchoolYearAndStudent
public static function retrieveCriteriaByCareerSchoolYearAndStudent(CareerSchoolYear $career_school_year, Student $student, PropelPDO $con = null, $approved = false)
{
if (is_null($con)) {
$con = Propel::getConnection();
}
$c = new Criteria();
$c->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year->getId());
$c->addJoin(CourseSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID, CareerSubjectSchoolYearPeer::ID);
$c->addJoin(CourseSubjectPeer::ID, self::COURSE_SUBJECT_ID);
$c->add(self::STUDENT_ID, $student->getId());
if ($approved) {
$c->add(self::STUDENT_APPROVED_COURSE_SUBJECT_ID, null, Criteria::ISNOTNULL);
}
$c->addGroupByColumn(self::COURSE_SUBJECT_ID);
return $c;
}
示例14: doSelectDirectlyMonitoredByUser
public static function doSelectDirectlyMonitoredByUser($user, $criteria = null)
{
if (!$user instanceof OppUser) {
throw new Exception('A user must be specified');
}
// fetch directly monitored acts
$directly_monitored_acts_pks = Util::transformIntoPKs($user->getMonitoredObjects('OppAtto', $criteria));
// fetch types of acts directly monitored
$c = new Criteria();
$c->addJoin(OppTipoAttoPeer::ID, OppAttoPeer::TIPO_ATTO_ID);
$c->addGroupByColumn(OppAttoPeer::TIPO_ATTO_ID);
$c->add(OppAttoPeer::ID, $directly_monitored_acts_pks, Criteria::IN);
$directly_monitored_acts_types = OppTipoAttoPeer::doSelect($c);
unset($c);
return $directly_monitored_acts_types;
}
示例15: execute
public function execute($request)
{
$brandId = $this->getRequestParameter('brand');
$query = $this->getRequestParameter('query');
//get series for this brand
$cSeries = new Criteria();
if ($brandId) {
$cSeries->add(SeriesPeer::BRAND_ID, $brandId);
}
$cSeries->add(SeriesPeer::SERIES_NAME, $query . '%', Criteria::LIKE);
$cSeries->addGroupByColumn(SeriesPeer::SERIES_NAME);
$cSeries->addAscendingOrderByColumn(SeriesPeer::SERIES_NAME);
$cSeries->setLimit(15);
$this->serieses = SeriesPeer::doSelect($cSeries);
$this->getResponse()->setContentType('application/json');
}