本文整理汇总了PHP中Criteria::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::Add方法的具体用法?PHP Criteria::Add怎么用?PHP Criteria::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeActividadesPorDocente
function executeActividadesPorDocente()
{
$this->id_docente = $this->getRequestParameter('id');
$this->docente = DocentePeer::RetrieveByPK($this->id_docente);
if (!$this->docente) {
$this->forward404();
}
$c = new Criteria();
$c->Add(RelAnioActividadDocentePeer::FK_DOCENTE_ID, $this->docente->getId());
$this->actividades = RelAnioActividadDocentePeer::doSelect($c);
}
示例2: execute
/**
* Will investigate a single entry
*/
public function execute()
{
$partial = $this->getP("partial");
$this->widget = null;
$this->forceSystemAuthentication();
// myDbHelper::$use_alternative_con = null;
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
// dont' filter out anything
entryPeer::setUseCriteriaFilter(false);
$partner_id = $this->getP("partner_id");
$this->entries = $this->widget_id = null;
$this->count = 0;
$this->page = $this->getP("page", 0);
$this->page_size = $this->getP("page_size", 25);
$this->ready_only = $this->getP("ready_only", 0);
$this->gte_int_id = $this->getP("gte_int_id", null);
$this->widget_id = $this->getP("widget_id");
$this->ui_conf_id = $this->getP("ui_conf_id");
$this->is_playlist = $this->getP("is_playlist");
$this->playlist_id = $this->getP("playlist_id");
$offset = $this->page * $this->page_size;
if ($partner_id !== null) {
$c = new Criteria();
if ($partner_id != "ALL") {
// is is a special backdoor word for viewing all partners
$c->add(entryPeer::PARTNER_ID, $partner_id);
}
if ($this->ready_only) {
$c->add(entryPeer::STATUS, 2);
}
if ($entry_ids = $this->getP("entry_ids")) {
$entry_id_arr = explode(",", $entry_ids);
$c->Add(entryPeer::ID, $entry_id_arr, Criteria::IN);
}
$search_text = $this->getP("filter__like_search_text");
if ($search_text) {
$c->add(entryPeer::SEARCH_TEXT, "%{$search_text}%", Criteria::LIKE);
}
if ($this->gte_int_id) {
$c->add(entryPeer::INT_ID, $this->gte_int_id, Criteria::GREATER_EQUAL);
}
if ($this->getP("filter__in_type_all")) {
} else {
$media_type_arr = array($this->getP("filter__in_type_1"), $this->getP("filter__in_type_2"), $this->getP("filter__in_type_5"), $this->getP("filter__in_type_6"));
$c->add(entryPeer::MEDIA_TYPE, $media_type_arr, Criteria::IN);
}
if ($this->getP("filter__in_status_all")) {
} else {
$status_arr = array($this->getP("filter__in_type_0"), $this->getP("filter__in_type_1"), $this->getP("filter__in_type_2"), $this->getP("filter__in_type_3"), $this->getP("filter__in_type_6"));
if ($this->getP("filter__in_status_err")) {
$status_arr[] = -1;
$status_arr[] = -2;
}
$c->add(entryPeer::STATUS, $status_arr, Criteria::IN);
}
if ($this->getP("filter__gte_created_at")) {
$c->addAnd(entryPeer::CREATED_AT, $this->getP("filter__gte_created_at"), Criteria::GREATER_EQUAL);
}
if ($this->getP("filter__lte_created_at")) {
$to_date = $this->getP("filter__lte_created_at");
$timeStamp = strtotime($to_date);
$timeStamp += 24 * 60 * 60;
// inc one day
$to_date_str = date("Y-m-d", $timeStamp);
$c->addAnd(entryPeer::CREATED_AT, $to_date_str, Criteria::LESS_EQUAL);
}
$this->count = entryPeer::doCount($c);
$c->addAscendingOrderByColumn(entryPeer::INT_ID);
$c->setLimit($this->page_size);
$c->setOffset($offset);
$this->entries = entryPeer::doSelect($c);
if (!$partial) {
// no need for widget if displaying partial page
$d = new Criteria();
$d->add(widgetPeer::PARTNER_ID, $partner_id);
if ($this->widget_id) {
$d->add(widgetPeer::ID, $this->widget_id);
} else {
$d->add(widgetPeer::SOURCE_WIDGET_ID, "");
}
$this->widget = widgetPeer::doSelectOne($d);
if (!$this->widget) {
$d = new Criteria();
$d->add(widgetPeer::PARTNER_ID, $partner_id);
$d->addAscendingOrderByColumn(widgetPeer::CREATED_AT);
$this->widget = widgetPeer::doSelectOne($d);
}
}
}
if ($this->entries == null) {
$this->entries = array();
}
$this->partner_id = $partner_id;
if ($partial) {
return "PartialSuccess";
}
}
示例3: Criteria
define('SF_DEBUG', true);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
sfContext::getInstance();
print "Fetching data... \n";
$c = new Criteria();
$c->setOffset(959);
$c->setLimit(31);
$politici = OppSenatoriPeer::doSelect($c);
$count = 1;
foreach ($politici as $politico) {
echo "id openpolis: " . $politico->getOpId() . "\n";
$c1 = new Criteria();
$c1->Add(OppParlamentariVotazioniPeer::ID_PARLAMENTARE, $politico->getId(), Criteria::EQUAL);
$votazioni_politico = OppParlamentariVotazioniPeer::doSelect($c1);
foreach ($votazioni_politico as $votazione_politico) {
$c2 = new Criteria();
$c2->Add(OppVotazioneHasPoliticoPeer::POLITICO_ID, $politico->getOpId());
$c2->Add(OppVotazioneHasPoliticoPeer::VOTAZIONE_ID, $votazione_politico->getIdVotazione());
$controllo = OppVotazioneHasPoliticoPeer::doSelect($c2);
if ($controllo == null) {
echo "politico: " . $count . " - votazione: " . $votazione_politico->getIdVotazione() . "\n";
$parlamentare_has_votazione = new OppVotazioneHasPolitico();
$parlamentare_has_votazione->setPoliticoId($politico->getOpId());
$parlamentare_has_votazione->setVotazioneId($votazione_politico->getIdVotazione());
$parlamentare_has_votazione->setVoto($votazione_politico->getVotazione());
$parlamentare_has_votazione->save();
}
}
$count++;
}
print "done.\n";
示例4: getVotiCount
public function getVotiCount()
{
$c = new Criteria();
$c->addJoin(OppPoliticoPeer::ID, OppCaricaPeer::POLITICO_ID, Criteria::INNER_JOIN);
$c->addJoin(OppCaricaPeer::ID, OppVotazioneHasCaricaPeer::CARICA_ID, Criteria::INNER_JOIN);
$c->Add(OppPoliticoPeer::ID, $this->getId());
return OppVotazioneHasCaricaPeer::doCount($c);
}