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


PHP Doctrine_Query::Create方法代码示例

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


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

示例1: filterSearch

 public function filterSearch()
 {
     //Переменные, полученные со страницы запроса
     $agency_name = $this->input->post('name', TRUE);
     $user_city = $this->input->post('city', TRUE);
     $sort_by_rate = $this->input->post('rating', TRUE) ? TRUE : FALSE;
     //Формируем строку запроса к базе данных на основе полученных значений фильтров
     $querys = array();
     //Если в запросе есть название агенства
     if (!empty($agency_name)) {
         $querys[] = 'a.name LIKE \'%' . $agency_name . '%\'';
     }
     //Если явно указан город
     if ($user_city != '0') {
         $querys[] = 'a.city_id = ' . $user_city;
     }
     //Сортировка по рейтингу
     $order = $sort_by_rate ? 'a.rating DESC' : 'a.id ASC';
     $query = count($querys) != 0 ? implode(' AND ', $querys) : '1';
     $agencys = Doctrine_Query::Create()->from('Agency a')->leftJoin('a.user u')->leftJoin('u.paid_feature p')->where('p.show_in_catalog_date > ?', strtotime('now'))->orWhere('a.manually_in_catalog = ?', '1')->andWhere($query)->orderBy($order)->execute();
     if (count($agencys) > 0) {
         $results = $this->createAgencysHtml($agencys);
     } else {
         $results = 'Поиск не дал результатов!';
     }
     $selected_items = array('name' => $agency_name, 'city' => $user_city, 'rating' => $sort_by_rate);
     $data = array('selected_items' => $selected_items, 'results' => $results, 'last_comments' => $this->getLastCommentsBlock(), 'pagination' => '');
     $this->template->view('catalog/main', $data);
 }
开发者ID:peter7570,项目名称:reposit,代码行数:29,代码来源:catalog.php

示例2: prepareUpdateView

 protected function prepareUpdateView($baseModel = NULL)
 {
     $route_types = array();
     $trunkList = array();
     $interfaceList = array();
     $numbers = Doctrine_Query::Create()->select("Number.number_id,Number.number,Number.foreign_id")->from("Number,NumberPool,NumberType")->where("NumberType.class='ExternalXferNumber'")->andWhere("NumberType.number_type_id=NumberPool.number_type_id")->andWhere("NumberPool.number_id=Number.number_id");
     if ($this->externalxfer->external_xfer_id) {
         $numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL or Number.foreign_id=?)", $this->externalxfer->external_xfer_id);
     } else {
         $numbers = $numbers->andWhere("(Number.class_type='' or Number.class_type IS NULL )");
     }
     $numbers = $numbers->orderBy('Number.number')->execute(array(), Doctrine::HYDRATE_SCALAR);
     $this->view->numbers = array();
     $this->view->numberdefault = NULL;
     $matchcount = 0;
     foreach ($numbers as $number) {
         $this->view->numbers[$number['Number_number_id']] = $number['Number_number'];
         if ($this->externalxfer->external_xfer_id == $number['Number_foreign_id']) {
             $this->view->numberdefault = $number['Number_number_id'];
             $matchcount++;
         }
     }
     if ($matchcount > 1) {
         message::set('This record cannot be edited, due to having multiple numbers');
         $this->returnQtipAjaxForm(NULL);
         url::redirect(Router_Core::$controller);
     }
     if (class_exists('Trunk')) {
         $trunks = Doctrine::getTable('Trunk')->findAll(Doctrine::HYDRATE_ARRAY);
         foreach ($trunks as $trunk) {
             $trunkList[$trunk['trunk_id']] = $trunk['name'];
         }
         if (!empty($trunkList)) {
             $route_types[ExternalXfer::TYPE_TRUNK] = 'via Trunk';
         }
     }
     if (class_exists('SipInterface')) {
         $interfaces = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY);
         foreach ($interfaces as $interface) {
             $interfaceList[$interface['sipinterface_id']] = $interface['name'];
         }
         if (!empty($interfaceList)) {
             $route_types[ExternalXfer::TYPE_SIP] = 'via SIP URI';
         }
     }
     if (empty($route_types)) {
         message::set('No Trunk or Sip Interfaces avaliable to route external destinations through!');
         $this->returnQtipAjaxForm(NULL);
         url::redirect(Router_Core::$controller);
     }
     if (empty($numbers)) {
         message::set('No extensions available!');
         $this->returnQtipAjaxForm(NULL);
         url::redirect(Router_Core::$controller);
     }
     $this->view->trunks = $trunkList;
     $this->view->interfaces = $interfaceList;
     $this->view->route_types = $route_types;
     parent::prepareUpdateView($baseModel);
 }
开发者ID:swk,项目名称:bluebox,代码行数:60,代码来源:externalxfersimple.php

示例3: getActiveJobs

 public function getActiveJobs($max = 10)
 {
     $query = Doctrine_Query::Create()->from('JobeetJob j')->where('j.category_id = ?', $this->getId())->limit($max);
     return Doctrine::getTable('JobeetJob')->getActiveJobs($query);
 }
开发者ID:BGCX262,项目名称:zurielcodejobeettest-svn-to-git,代码行数:5,代码来源:JobeetCategory.class.php

示例4: getByClockIn

 public function getByClockIn($clock_in)
 {
     return Doctrine_Query::Create()->from('TimeLogType t')->where('t.clock_in <> ?', $clock_in)->execute();
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:TimeLogTypeTable.class.php

示例5: queryWithSlots

 public static function queryWithSlots($version = false, $culture = null)
 {
     if (is_null($culture)) {
         $culture = aTools::getUserCulture();
     }
     $query = Doctrine_Query::Create()->select("p.*, a.*, v.*, avs.*, s.*, m.*")->from("aPage p");
     if ($culture === 'all') {
         $query = $query->leftJoin('p.Areas a');
     } else {
         $query = $query->leftJoin('p.Areas a WITH a.culture = ?', array($culture));
     }
     if ($version === false) {
         $query = $query->leftJoin('a.AreaVersions v WITH (a.latest_version = v.version)');
     } else {
         $query = $query->leftJoin('a.AreaVersions v WITH (v.version = ?)', array($version));
     }
     return $query->leftJoin('v.AreaVersionSlots avs')->leftJoin('avs.Slot s')->leftJoin('s.MediaItems m')->orderBy('avs.rank asc');
 }
开发者ID:verenate,项目名称:gri,代码行数:18,代码来源:PluginaPageTable.class.php

示例6: isEntitled

 public function isEntitled()
 {
     return Doctrine_Query::Create()->from('Task t')->where('t.created_by = ?', myUser::getLoggedIn()->getId())->andWhere('t.id = ?', $this->getId())->orWhere('t.user_id = ?', myUser::getLoggedIn()->getId())->andWhere('t.id = ?', $this->getId())->limit(1)->fetchOne();
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:Task.class.php

示例7: retrieveByPath

 /**
  * Retrieves folder by relative path
  *
  * @param string $path
  * @param string $separator
  * @return sfAssetFolder
  */
 public static function retrieveByPath($path = '', $separator = DIRECTORY_SEPARATOR)
 {
     $path = self::cleanPath($path);
     return Doctrine_Query::Create()->from('sfAssetFolder f')->where('f.relative_path = ?', $path ? $path : null)->fetchOne();
 }
开发者ID:vjousse,项目名称:sfDoctrineAssetsLibraryPlugin,代码行数:12,代码来源:PluginsfAssetFolderTable.class.php

示例8: getByStaffId

 public function getByStaffId()
 {
     return Doctrine_Query::Create()->from('TaskComment tc')->where('tc.staff_id = ?', Staff::loggedInId())->execute();
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:TaskCommentTable.class.php

示例9: getAllByAccountInvoiceId

 public function getAllByAccountInvoiceId($account_invoice_id)
 {
     return Doctrine_Query::Create()->from('Task t')->where('t.account_invoice_id = ?', $account_invoice_id)->execute();
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:TaskTable.class.php

示例10: getLastTimeLogTypeByStaffId

 public function getLastTimeLogTypeByStaffId($staff_id)
 {
     return Doctrine_Query::Create()->select('tl.time_log_type_id')->from('TimeLog tl')->where('tl.staff_id = ?', $staff_id)->orderBy('tl.time DESC')->limit(1)->fetchOne()->time_log_type_id;
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:TimeLogTable.class.php

示例11: getLastRefNo

 public function getLastRefNo()
 {
     return Doctrine_Query::Create()->select('ai.ref_no')->from('AccountInvoice ai')->orderBy('ai.id DESC')->limit(1)->fetchOne()->ref_no;
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:AccountInvoiceTable.class.php

示例12: queryAllByUserId

 public function queryAllByUserId($sort)
 {
     return Doctrine_Query::Create()->from('Account a')->where('a.client_id = ?', myUser::getLoggedIn()->isClient()->getId())->orderBy('a.' . $sort);
 }
开发者ID:nidhhoggr,项目名称:supra,代码行数:4,代码来源:AccountTable.class.php


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