當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。