本文整理汇总了PHP中Criteria::addJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP Criteria::addJoin方法的具体用法?PHP Criteria::addJoin怎么用?PHP Criteria::addJoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criteria
的用法示例。
在下文中一共展示了Criteria::addJoin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
public function executeIndex(sfWebRequest $request)
{
//get request parameters
$this->selectedBrand = $this->getRequestParameter('brand');
$this->selectedSeries = $this->getRequestParameter('series');
$this->selectedModel = $this->getRequestParameter('model');
$cConfig = new Criteria();
$cConfig->addJoin(ConfigPeer::MODEL_ID, ModelPeer::ID);
$cConfig->addJoin(ModelPeer::SERIES_ID, SeriesPeer::ID);
$cConfig->addJoin(SeriesPeer::BRAND_ID, BrandPeer::ID);
if ($this->selectedBrand) {
$cConfig->add(BrandPeer::ID, $this->selectedBrand);
}
if ($this->selectedSeries) {
$cConfig->add(SeriesPeer::SERIES_NAME, $this->selectedSeries, Criteria::LIKE);
}
if ($this->selectedModel) {
$cConfig->add(ModelPeer::MODEL_NAME, $this->selectedModel, Criteria::LIKE);
}
//$this->Configs = ConfigPeer::doSelect($cConfig);
//paginatiom
$pager = new sfPropelPager('Config', 15);
$pager->setCriteria($cConfig);
$pager->setPage($this->getRequestParameter('page'));
$pager->init();
$this->pager = $pager;
//get config columns
$c = new Criteria();
$c->addDescendingOrderByColumn(ConfigFieldCategoryPeer::WEIGHT);
$this->configFieldCategories = ConfigFieldCategoryPeer::doSelect($c);
//get brands
$cBrand = new Criteria();
$this->brands = BrandPeer::doSelect($cBrand);
}
示例2: doSelectByStudent
public static function doSelectByStudent(Criteria $criteria, $con = null)
{
$usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo');
$student = null;
$student_id = null;
if ($usertype == 'student') {
$student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$student = StudentPeer::retrieveByPK($student_id);
}
if ($student == null) {
$student_id = sfContext::getInstance()->getRequest()->getParameter('student_id');
$student = StudentPeer::retrieveByPK($student_id);
}
$criteria->add(StudentPeer::CURRICULUM_ID, $student->getCurriculumId());
$criteria->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID);
$criteria->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID);
$tmp_depts = DepartmentPeer::doSelect($criteria);
$depts = array();
foreach ($tmp_depts as $key => $val) {
$pi = $val->getParentalIndex();
$prefix = '';
for ($i = 0; $i < $val->level - 1; $i++) {
$prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue();
}
$val->setdescription($prefix . $val->getDescription());
$val->setCode($prefix . $val->getCode());
$depts[$pi] = $val;
}
ksort($depts);
$result = array();
foreach ($depts as $r) {
$result[] = $r;
}
return $result;
}
示例3: execute
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
$this->createContextInstance();
$c1 = new Criteria();
$career_school_year = CareerSchoolYearPeer::retrieveBySchoolYear();
$c1->add(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year[0]->getId());
$c1->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::LAST_YEAR_REPPROVED);
$students_career_school_year = StudentCareerSchoolYearPeer::doSelectJoinCareerSchoolYear($c1);
foreach ($students_career_school_year as $student_career_school_year) {
$this->logSection('STUDENT CAREER SCHOOL YEAR ID', $student_career_school_year->getId());
$previous_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($student_career_school_year->getCareerSchoolYear()->getSchoolYear());
if (is_null($previous_school_year)) {
$this->logSection('action', 'continue');
continue;
}
$c = new Criteria();
$c->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student_career_school_year->getStudent()->getId());
$c->addJoin(StudentCareerSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID, Criteria::INNER_JOIN);
$c->addJoin(CareerSchoolYearPeer::CAREER_ID, CareerPeer::ID, Criteria::INNER_JOIN);
$c->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $previous_school_year->getId());
$c->add(StudentCareerSchoolYearPeer::STATUS, StudentCareerSchoolYearStatus::APPROVED);
if (StudentCareerSchoolYearPeer::doCount($c)) {
$this->logSection('action', 'fix');
$student_career_school_year->setStatus(StudentCareerSchoolYearStatus::IN_COURSE);
$student_career_school_year->save();
}
}
}
示例4: getPager
public static function getPager($max = 10, $page = 1, $camp_name = null, $agency_name = null, $agency_city = null, $agency_state = null, $agency_country = null, $airport_ident = null, $airport_city = null, $airport_state = null)
{
$c = new Criteria();
$c->addJoin(self::AGENCY_ID, AgencyPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::AIRPORT_ID, AirportPeer::ID, Criteria::LEFT_JOIN);
if ($camp_name) {
$c->add(self::CAMP_NAME, $camp_name . '%', Criteria::LIKE);
}
if ($agency_name) {
$c->add(AgencyPeer::NAME, $agency_name . '%', Criteria::LIKE);
}
if ($agency_city) {
$c->add(AgencyPeer::CITY, $agency_city . '%', Criteria::LIKE);
}
if ($agency_state) {
$c->add(AgencyPeer::STATE, $agency_state . '%', Criteria::LIKE);
}
if ($airport_ident) {
$c->add(AirportPeer::IDENT, $airport_ident . '%', Criteria::LIKE);
}
if ($airport_city) {
$c->add(AirportPeer::CITY, $airport_city . '%', Criteria::LIKE);
}
if ($airport_state) {
$c->add(AirportPeer::STATE, $airport_state . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::CAMP_NAME);
$pager = new sfPropelPager('Camp', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例5: doSelectByRegPeriod
public static function doSelectByRegPeriod(Criteria $c = null, $rpi = null)
{
$tsi = null;
if ($rpi == null) {
$tsi = sfContext::getInstance()->getRequest()->getParameter('id');
}
if ($rpi == null && $tsi == null) {
return array();
}
$ids = '';
if ($rpi != null) {
$c = new Criteria();
$c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID);
$c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID);
$c->add(RegPeriodPeer::ID, $rpi);
$dept = DepartmentPeer::doSelectOne($c);
$ids = $dept->getIdRecurs();
}
if ($tsi != null) {
$c = new Criteria();
$c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID);
$c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID);
$c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID);
$c->add(TestSchedulePeer::ID, $tsi);
$dept = DepartmentPeer::doSelectOne($c);
$ids = $dept->getIdRecurs();
}
$sql = "select * from test_subject where department_id in ({$ids})";
$connection = Propel::getConnection();
$statement = $connection->createStatement();
$result = $statement->executeQuery($sql, ResultSet::FETCHMODE_NUM);
$objs = TestSubjectPeer::populateObjects($result);
return $objs;
}
示例6: 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;
}
示例7: 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;
}
示例8: addStudentColumnCriteria
public function addStudentColumnCriteria(Criteria $criteria, $field, $value)
{
$criteria->add(PersonPeer::ID, $value);
$criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
$criteria->addJoin(DivisionStudentPeer::STUDENT_ID, StudentPeer::ID);
$criteria->addJoin(DivisionPeer::ID, DivisionStudentPeer::DIVISION_ID);
}
示例9: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$criteria = new Criteria();
$criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
$criteria->add(QubitActorI18n::CULTURE, $this->context->user->getCulture());
$criteria->addJoin(QubitActor::ID, QubitObject::ID);
// Filter out non-authority Actors
$criteria->add(QubitObject::CLASS_NAME, 'QubitUser', Criteria::NOT_EQUAL);
$criteria->add(QubitObject::CLASS_NAME, 'QubitDonor', Criteria::NOT_EQUAL);
// Sort alphabetically by name
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
if (isset($request->showOnlyActors) && 'true' == $request->showOnlyActors) {
$criteria->add(QubitObject::CLASS_NAME, 'QubitActor');
}
if (isset($request->query)) {
$criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, "{$request->query}%", Criteria::LIKE);
}
// Exclude the calling actor from the list
$params = $this->context->routing->parse(Qubit::pathInfo($request->getReferer()));
$resource = $params['_sf_route']->resource;
if (isset($resource->id)) {
$criteria->add(QubitActor::ID, $resource->id, Criteria::NOT_EQUAL);
}
$this->pager = new QubitPager('QubitActor');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$this->actors = $this->pager->getResults();
$this->setTemplate('list');
}
示例10: getPager
public static function getPager($max = 10, $page = 1, $date_req = null, $pass_name = null, $req_name = null, $pass_lname = null, $req_lname = null)
{
$c = new Criteria();
$c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(self::REQUESTER_ID, RequesterPeer::ID, Criteria::LEFT_JOIN);
$c->addJoin(PassengerPeer::PERSON_ID, PersonPeer::alias('c1', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addJoin(RequesterPeer::PERSON_ID, PersonPeer::alias('c2', PersonPeer::ID), Criteria::LEFT_JOIN);
$c->addAlias('c1', PersonPeer::TABLE_NAME);
$c->addAlias('c2', PersonPeer::TABLE_NAME);
if ($date_req) {
$c->add(self::DATE_REQUESTED, '%' . date('Y-m-d', strtotime($date_req)) . '%', Criteria::LIKE);
}
if ($pass_name) {
$c->add(PersonPeer::alias("c1", PersonPeer::FIRST_NAME), $pass_name . '%', Criteria::LIKE);
}
if ($req_name) {
$c->add(PersonPeer::alias("c2", PersonPeer::FIRST_NAME), $req_name . '%', Criteria::LIKE);
}
if ($pass_lname) {
$c->add(PersonPeer::alias("c1", PersonPeer::LAST_NAME), $pass_lname . '%', Criteria::LIKE);
}
if ($req_lname) {
$c->add(PersonPeer::alias("c2", PersonPeer::LAST_NAME), $req_lname . '%', Criteria::LIKE);
}
$c->addAscendingOrderByColumn(self::DATE_REQUESTED);
$pager = new sfPropelPager('Itinerary', $max);
$pager->setCriteria($c);
$pager->setPage($page);
$pager->init();
return $pager;
}
示例11: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$criteria = new Criteria();
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
$criteria->add(QubitInformationObject::PARENT_ID, $this->resource->id);
} else {
$criteria->add(QubitInformationObject::PARENT_ID, QubitInformationObject::ROOT_ID);
}
if (isset($request->repositoryId)) {
$criteria->add(QubitInformationObject::REPOSITORY_ID, $request->repositoryId);
}
if (isset($request->collectionType)) {
$criteria->add(QubitInformationObject::COLLECTION_TYPE_ID, $request->collectionType);
}
$fallbackTable = 'QubitInformationObject';
switch ($request->sort) {
case 'repositoryDown':
$fallbackTable = 'QubitActor';
$criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN);
$criteria->addDescendingOrderByColumn('authorized_form_of_name');
break;
case 'repositoryUp':
$fallbackTable = 'QubitActor';
$criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN);
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
break;
case 'titleDown':
$criteria->addDescendingOrderByColumn('title');
break;
case 'titleUp':
$criteria->addAscendingOrderByColumn('title');
break;
case 'updatedDown':
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
break;
case 'updatedUp':
$criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT);
break;
default:
if (!$this->getUser()->isAuthenticated()) {
$criteria->addAscendingOrderByColumn('title');
} else {
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
}
}
// Do source culture fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, $fallbackTable);
// Filter drafts
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
// Page results
$this->pager = new QubitPager('QubitInformationObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
}
示例12: getLlistes
public static function getLlistes($email)
{
$C = new Criteria();
$C->add(self::EMAIL, $email);
$C->addJoin(self::IDEMAIL, LlistesLlistesEmailsPeer::IDEMAIL);
$C->addJoin(LlistesLlistesEmailsPeer::IDLLISTA, LlistesLlistesPeer::IDLLISTA);
return LlistesLlistesPeer::doSelect($C);
}
示例13: getFiles
public static function getFiles($entry_id, $idS)
{
$C = new Criteria();
$C->addJoin(self::ID, AppBlogMultimediaEntriesPeer::ENTRIES_ID);
$C->addJoin(AppBlogMultimediaEntriesPeer::MULTIMEDIA_ID, AppBlogsMultimediaPeer::ID);
$C->add(self::ID, $entry_id);
return AppBlogsMultimediaPeer::doSelect($C);
}
示例14: 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);
}
示例15: addStudentColumnCriteria
public function addStudentColumnCriteria(Criteria $criteria, $field, $value)
{
$criteria->addJoin(CourseSubjectStudentExaminationPeer::EXAMINATION_SUBJECT_ID, ExaminationSubjectPeer::ID);
$criteria->addJoin(CourseSubjectStudentExaminationPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID);
$criteria->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID);
$criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
$criteria->add(PersonPeer::ID, $value);
}