本文整理汇总了PHP中Criteria::addAsColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addAsColumn方法的具体用法?PHP Criteria::addAsColumn怎么用?PHP Criteria::addAsColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::addAsColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTriggerCriteria
/**
* Get criteria for Trigger
*
* return object
*/
public function getTriggerCriteria()
{
try {
$delimiter = \DBAdapter::getStringDelimiter();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\TriggersPeer::TRI_UID);
$criteria->addAsColumn("TRI_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("TRI_DESCRIPTION", "CD.CON_VALUE");
$criteria->addSelectColumn(\TriggersPeer::TRI_TYPE);
$criteria->addSelectColumn(\TriggersPeer::TRI_WEBBOT);
$criteria->addSelectColumn(\TriggersPeer::TRI_PARAM);
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\TriggersPeer::TRI_UID, "CT.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "TRI_TITLE" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
$arrayCondition = array();
$arrayCondition[] = array(\TriggersPeer::TRI_UID, "CD.CON_ID", \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "TRI_DESCRIPTION" . $delimiter, \Criteria::EQUAL);
$arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
return $criteria;
} catch (\Exception $e) {
throw $e;
}
}
示例2: getNotas
public function getNotas($ciclolectivo_id)
{
$notaAlumno = array();
$notaActividad = array();
// notas del alumno
$criteria = new Criteria();
$criteria->add(BoletinActividadesPeer::FK_ALUMNO_ID, $this->getId());
$criteria->add(PeriodoPeer::CALCULAR, false);
$criteria->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id);
$criteria->addJoin(BoletinActividadesPeer::FK_ESCALANOTA_ID, EscalanotaPeer::ID);
$criteria->addJoin(BoletinActividadesPeer::FK_PERIODO_ID, PeriodoPeer::ID);
$criteria->addAsColumn("boletinActividades_periodo_id", BoletinActividadesPeer::FK_PERIODO_ID);
$criteria->addAsColumn("boletinActividades_actividad_id", BoletinActividadesPeer::FK_ACTIVIDAD_ID);
$criteria->addAsColumn("escalanota_nombre", EscalanotaPeer::NOMBRE);
$aBoletinActividades = BasePeer::doSelect($criteria);
foreach ($aBoletinActividades as $boletinActividades) {
$notaAlumno[$boletinActividades[0]][$boletinActividades[1]] = $boletinActividades[2];
$notaActividad[$boletinActividades[1]][$boletinActividades[0]] = $boletinActividades[2];
}
$c = new Criteria();
$c->add(PeriodoPeer::FK_CICLOLECTIVO_ID, $ciclolectivo_id);
$c->add(PeriodoPeer::CALCULAR, true);
$periodos = PeriodoPeer::doSelect($c);
foreach ($notaActividad as $act_indice => &$act) {
foreach ($periodos as $periodo) {
//validar que esten ok
if (trim($periodo->getFormula()) != '') {
list($class_formula, $parametros) = explode('|', $periodo->getFormula());
$parametros = explode(',', $parametros);
//if (array_intersect($parametros,array_keys($act)) == $parametros) {
sfContext::getInstance()->getLogger()->debug("estan todo slo ids");
$class_formula = "formula_{$class_formula}";
require_once sfConfig::get('sf_lib_dir') . DIRECTORY_SEPARATOR . 'formulas' . DIRECTORY_SEPARATOR . $class_formula . ".class.php";
$formula = new $class_formula();
$notas_parametros = array();
foreach ($parametros as $parametro) {
if (isset($act[$parametro])) {
array_push($notas_parametros, sprintf("%01.2f", str_replace(",", ".", $act[$parametro])));
} else {
array_push($notas_parametros, '');
}
}
$nota = $formula->calcular($notas_parametros);
$notaAlumno[$periodo->getId()][$act_indice] = $nota;
$act[$periodo->getId()] = $nota;
//}
//else {
// sfContext::getInstance()->getLogger()->debug('faltan parametros para la formula');
//}
} else {
sfContext::getInstance()->getLogger()->debug('el periodo es calculable pero no tiene una formula cargada');
}
}
}
return $notaAlumno;
}
示例3: getEmailEventServerAccounts
/**
* Get the email server accounts of the current workspace
*
* return array
*/
public function getEmailEventServerAccounts()
{
try {
$criteria = new \Criteria("workflow");
$criteria->clearSelectColumns();
$criteria->addSelectColumn(\EmailServerPeer::MESS_UID);
$criteria->addSelectColumn(\EmailServerPeer::MESS_FROM_MAIL);
$criteria->addSelectColumn(\EmailServerPeer::MESS_ACCOUNT);
$criteria->addAsColumn('UID', 'MESS_UID');
$result = \EmailServerPeer::doSelectRS($criteria);
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$result->next();
$accountsArray = array();
while ($aRow = $result->getRow()) {
if ($aRow['MESS_UID'] != null) {
if($aRow['MESS_FROM_MAIL'] == "") {
$aRow['EMAIL'] = $aRow['MESS_ACCOUNT'];
} else {
$aRow['EMAIL'] = $aRow['MESS_FROM_MAIL'];
}
$accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
}
$result->next();
}
return $accountsArray;
} catch (\Exception $e) {
throw $e;
}
}
示例4: 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;
}
示例5: addFallbackColumns
/**
* Assign fallback values for each column in the $fallbackClassName table
*
* @param Criteria $criteria
* @param string $fallbackClass name of Prople class for table with desired fallback columns
* @return Criteria $criteria object withi extra calculated fallback columns
*/
public static function addFallbackColumns($criteria, $fallbackClassName)
{
$tableMap = eval('return new ' . substr($fallbackClassName, 5) . 'TableMap;');
// Loop through table columns and add fallback calculated fields to criteria
foreach ($tableMap->getColumns() as $col) {
$criteria->addAsColumn($col->getColumnName(), self::getfallbackCaseStmt($col->getColumnName()));
}
return $criteria;
}
示例6: getEvents
/**
* Get list for Events
* @var string $pro_uid. Uid for Process
* @var string $filter.
* @var string $evn_uid. Uid for Process
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
public function getEvents($pro_uid, $filter = '', $evn_uid = '')
{
$pro_uid = $this->validateProUid($pro_uid);
if ($evn_uid != '') {
$evn_uid = $this->validateEvnUid($evn_uid);
}
$oProcess = new \Process();
if (!$oProcess->processExists($pro_uid)) {
throw new \Exception(\G::LoadTranslation("ID_PROCESS_NOT_EXIST", array('pro_uid', $pro_uid)));
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\EventPeer::EVN_UID);
$oCriteria->addSelectColumn(\EventPeer::EVN_ACTION);
$oCriteria->addSelectColumn(\EventPeer::EVN_STATUS);
$oCriteria->addSelectColumn(\EventPeer::EVN_WHEN_OCCURS);
$oCriteria->addSelectColumn(\EventPeer::EVN_RELATED_TO);
$oCriteria->addAsColumn('EVN_DESCRIPTION', \ContentPeer::CON_VALUE);
$aConditions = array();
$aConditions[] = array(\EventPeer::EVN_UID, \ContentPeer::CON_ID);
$aConditions[] = array(\ContentPeer::CON_CATEGORY, $sDelimiter . 'EVN_DESCRIPTION' . $sDelimiter);
$aConditions[] = array(\ContentPeer::CON_LANG, $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
$oCriteria->add(\EventPeer::PRO_UID, $pro_uid);
if ($evn_uid != '') {
$oCriteria->add(\EventPeer::EVN_UID, $evn_uid);
}
switch ($filter) {
case 'message':
$oCriteria->add(\EventPeer::EVN_ACTION, "SEND_MESSAGE");
break;
case 'conditional':
$oCriteria->add(\EventPeer::EVN_ACTION, "EXECUTE_CONDITIONAL_TRIGGER");
break;
case 'multiple':
$oCriteria->add(\EventPeer::EVN_ACTION, "EXECUTE_TRIGGER");
break;
}
$eventsArray = array();
$oDataset = \EventPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$oEvent = new \Event();
$aFields = $oEvent->load($aRow['EVN_UID']);
$aRow = array_merge($aRow, $aFields);
$eventsArray[] = array_change_key_case($aRow, CASE_LOWER);
$oDataset->next();
}
if ($evn_uid != '' && empty($eventsArray)) {
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} elseif ($evn_uid != '' && !empty($eventsArray)) {
return current($eventsArray);
}
return $eventsArray;
}
示例7: retrieveTotalsize
public static function retrieveTotalsize(Criteria $criteria = null)
{
if (is_null($criteria)) {
$criteria = new Criteria();
}
$criteria->addAsColumn('total', "SUM(" . self::SIZE . ")");
$stmt = self::doSelectStmt($criteria);
$row = $stmt->fetch();
return $row['total'];
}
示例8: criteriaOrderByDistance
/**
*
* @param string $lat_col_name
* @param string $lng_col_name
* @param float $lat
* @param float $lng
* @param Criteria $criteria
* @return Criteria
* @author fabriceb
* @since Sep 9, 2009
*/
public static function criteriaOrderByDistance($lat_col_name, $lng_col_name, $lat, $lng, $criteria = null)
{
if (is_null($criteria)) {
$criteria = new Criteria();
}
$distance_query = '(POW(( %s - %F ),2) + POW(( %s - %F ),2))';
$distance_query = sprintf($distance_query, $lat_col_name, $lat, $lng_col_name, $lng);
$criteria->addAsColumn('distance', $distance_query);
$criteria->addAscendingOrderByColumn('distance');
return $criteria;
}
示例9: testCreateSelectSqlPart
public function testCreateSelectSqlPart()
{
Propel::setDb('oracle', new DBOracle());
$db = Propel::getDB();
$c = new Criteria();
$c->addSelectColumn(BookPeer::ID);
$c->addAsColumn('book_ID', BookPeer::ID);
$fromClause = array();
$selectSql = $db->createSelectSqlPart($c, $fromClause);
$this->assertEquals('SELECT book.ID, book.ID AS book_ID', $selectSql, 'createSelectSqlPart() returns a SQL SELECT clause with both select and as columns');
$this->assertEquals(array('book'), $fromClause, 'createSelectSqlPart() adds the tables from the select columns to the from clause');
}
示例10: getCriteriaDBSList
public function getCriteriaDBSList($sProcessUID)
{
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(DbSourcePeer::DBS_UID);
$oCriteria->addSelectColumn(DbSourcePeer::PRO_UID);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_TYPE);
$oCriteria->addAsColumn("DBS_SERVER", "CASE WHEN " . DbSourcePeer::DBS_TYPE . " = 'oracle' AND " . DbSourcePeer::DBS_CONNECTION_TYPE . " = 'TNS' THEN CONCAT('[', " . DbSourcePeer::DBS_TNS . ", ']') ELSE " . DbSourcePeer::DBS_SERVER . " END");
$oCriteria->addAsColumn("DBS_DATABASE_NAME", "CASE WHEN " . DbSourcePeer::DBS_TYPE . " = 'oracle' AND " . DbSourcePeer::DBS_CONNECTION_TYPE . " = 'TNS' THEN CONCAT('[', " . DbSourcePeer::DBS_TNS . ", ']') ELSE " . DbSourcePeer::DBS_DATABASE_NAME . " END");
$oCriteria->addSelectColumn(DbSourcePeer::DBS_USERNAME);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_PASSWORD);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_PORT);
$oCriteria->addAsColumn('DBS_DESCRIPTION', 'C.CON_VALUE');
$oCriteria->addAlias('C', 'CONTENT');
$aConditions = array();
$aConditions[] = array(DbSourcePeer::DBS_UID, 'C.CON_ID');
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DBS_DESCRIPTION' . $sDelimiter);
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
return $oCriteria;
}
示例11: execute
/**
* Execute digitalobject list action
*
* @param sfWebRequest $request
*/
public function execute($request)
{
// Build funky join query to get a count of top level digital objects
// for each media type (term)
$criteria = new Criteria();
$criteria->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::MEDIA_TYPE_ID);
$criteria->addJoin(QubitTerm::ID, QubitDigitalObject::MEDIA_TYPE_ID, Criteria::LEFT_JOIN);
$criteria->addAsColumn('hits', 'COUNT(' . QubitDigitalObject::ID . ')');
$criteria->addGroupByColumn(QubitTerm::ID);
// Add I18n fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitTerm');
$criteria->addAscendingOrderByColumn('name');
// Filter drafts
$criteria->addJoin(QubitDigitalObject::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->terms = QubitTerm::get($criteria);
}
示例12: getFrontPagePager
public static function getFrontPagePager($page)
{
$pager = new sfPropelPager('Question', sfConfig::get('app_pager_homepage_max'));
$c = new Criteria();
$c->addAsColumn('count', "count(" . InterestPeer::USER_ID . ")");
$c->addJoin(InterestPeer::QUESTION_ID, QuestionPeer::ID);
$c->addGroupByColumn(InterestPeer::QUESTION_ID);
$c->addDescendingOrderByColumn('count');
$c->addDescendingOrderByColumn(self::CREATED_AT);
$c->add(InterestPeer::CREATED_AT, time() - 86400 * 10, Criteria::GREATER_THAN);
$c = self::addPermanentTagToCriteria($c);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->setPeerMethod('doSelectJoinUser');
$pager->init();
return $pager;
}
示例13: getCalendarList
public function getCalendarList ($onlyActive = false, $arrayMode = false)
{
$Criteria = new Criteria( 'workflow' );
$Criteria->clearSelectColumns();
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UID );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_NAME );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_CREATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_UPDATE_DATE );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_DESCRIPTION );
$Criteria->addSelectColumn( CalendarDefinitionPeer::CALENDAR_STATUS );
// $Criteria->addAsColumn('DELETABLE', "IF (CALENDAR_UID <> '00000000000000000000000000000001', '".G::LoadTranslation('ID_DELETE')."','') ");
$Criteria->addAsColumn( 'DELETABLE', "CASE WHEN CALENDAR_UID <> '00000000000000000000000000000001' THEN '" . G::LoadTranslation( 'ID_DELETE' ) . "' ELSE '' END " );
// Note: This list doesn't show deleted items (STATUS = DELETED)
if ($onlyActive) {
// Show only active. Used on assignment lists
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, "ACTIVE", CRITERIA::EQUAL );
} else {
// Show Active and Inactive calendars. USed in main list
$Criteria->add( calendarDefinitionPeer::CALENDAR_STATUS, array ("ACTIVE","INACTIVE"), CRITERIA::IN );
}
$Criteria->add( calendarDefinitionPeer::CALENDAR_UID, "xx", CRITERIA::NOT_EQUAL );
if (! $arrayMode) {
return $Criteria;
} else {
$oDataset = calendarDefinitionPeer::doSelectRS( $Criteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$calendarA = array (0 => 'dummy');
$calendarCount = 0;
while (is_array( $aRow = $oDataset->getRow() )) {
$calendarCount ++;
$calendarA[$calendarCount] = $aRow;
$oDataset->next();
}
$return['criteria'] = $Criteria;
$return['array'] = $calendarA;
return $return;
}
}
示例14: getCriteriaDBSList
public function getCriteriaDBSList($sProcessUID)
{
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(DbSourcePeer::DBS_UID);
$oCriteria->addSelectColumn(DbSourcePeer::PRO_UID);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_TYPE);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_SERVER);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_DATABASE_NAME);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_USERNAME);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_PASSWORD);
$oCriteria->addSelectColumn(DbSourcePeer::DBS_PORT);
$oCriteria->addAsColumn('DBS_DESCRIPTION', 'C.CON_VALUE');
$oCriteria->addAlias('C', 'CONTENT');
$aConditions = array();
$aConditions[] = array(DbSourcePeer::DBS_UID, 'C.CON_ID');
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DBS_DESCRIPTION' . $sDelimiter);
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
return $oCriteria;
}
示例15: getSubprocesss
/**
* Get SubProcess in Process
*
* return object
*/
public function getSubprocesss($pro_uid, $tas_uid)
{
try {
$pro_uid = $this->validateProUid($pro_uid);
$tas_uid = $this->validateTasUid($tas_uid);
$oCriteria = new \Criteria('workflow');
$del = \DBAdapter::getStringDelimiter();
$oCriteria->add(SubProcessPeer::PRO_PARENT, $pro_uid);
$oCriteria->add(SubProcessPeer::TAS_PARENT, $tas_uid);
$oCriteria->addAsColumn('CON_VALUE', 'C1.CON_VALUE', 'CON_TITLE');
$oCriteria->addAlias("C1", 'CONTENT');
$tasTitleConds = array();
$tasTitleConds[] = array(SubProcessPeer::TAS_PARENT, 'C1.CON_ID');
$tasTitleConds[] = array('C1.CON_CATEGORY', $del . 'TAS_TITLE' . $del);
$tasTitleConds[] = array('C1.CON_LANG', $del . SYS_LANG . $del);
$oCriteria->addJoinMC($tasTitleConds, \Criteria::LEFT_JOIN);
$oDataset = SubProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
$aRow = array_change_key_case($aRow, CASE_LOWER);
$response['spr_uid'] = $aRow['sp_uid'];
$response['spr_pro_parent'] = $aRow['pro_parent'];
$response['spr_tas_parent'] = $aRow['tas_parent'];
$response['spr_pro'] = $aRow['pro_uid'];
$response['spr_tas'] = $aRow['tas_uid'];
$response['spr_name'] = $aRow['con_value'];
$response['spr_synchronous'] = $aRow['sp_synchronous'];
$response['spr_variables_out'] = unserialize($aRow['sp_variables_out']);
if ((int) $response['spr_synchronous'] === 1) {
$response['spr_variables_in'] = unserialize($aRow['sp_variables_in']);
}
return $response;
} catch (\Exception $e) {
throw $e;
}
}