當前位置: 首頁>>代碼示例>>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方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testTicket

 public function testTicket()
 {
     // SELECT picture_id FROM ItemPicture INNER JOIN Puzzle ON ItemPicture.item_id=ItemPuzzle_item_id
     $q = Doctrine_Query::create()->select('pic.id')->from('T1467_Picture pic')->innerJoin('pic.Items ite')->innerJoin('ite.Puzzles puz');
     $this->assertEqual($q->getDql(), 'SELECT pic.id FROM T1467_Picture pic INNER JOIN pic.Items ite INNER JOIN ite.Puzzles puz');
     $this->assertEqual($q->getSqlQuery(), 'SELECT t.id AS t__id FROM t1467__picture t INNER JOIN t1467__item_picture t3 ON (t.id = t3.picture_id) INNER JOIN t1467__item t2 ON t2.id = t3.item_id INNER JOIN t1467__item_puzzle t5 ON (t2.id = t5.item_id) INNER JOIN t1467__puzzle t4 ON t4.id = t5.puzzle_id');
 }
開發者ID:ninjapenguin,項目名稱:kohana-Doctrine-module,代碼行數:7,代碼來源:1467TestCase.php

示例2: doMassAction

 public function doMassAction($user_id, $is_admin = false)
 {
     if ($this->isBound() && $this->isValid()) {
         $actions_values = $this->getValue('MassActionForm');
         $query = Doctrine_Query::create()->update('Specimens s');
         if ($is_admin === false) {
             $query->andWhere('s.id in (select fct_filter_encodable_row(?,?,?))', array(implode(',', $this->getValue('item_list')), 'spec_ref', $user_id));
         } else {
             $query->andWhere('s.id in (' . implode(',', $this->getValue('item_list')) . ')');
         }
         $group_action = 0;
         foreach ($this->embeddedForms['MassActionForm'] as $key => $form) {
             if (method_exists($this->getEmbeddedForm('MassActionForm')->getEmbeddedForm($key), 'doGroupedAction')) {
                 $this->getEmbeddedForm('MassActionForm')->getEmbeddedForm($key)->doGroupedAction($query, $actions_values[$key], $this->getValue('item_list'));
                 $group_action++;
             }
             if (method_exists($this->getEmbeddedForm('MassActionForm')->getEmbeddedForm($key), 'doMassAction')) {
                 $this->getEmbeddedForm('MassActionForm')->getEmbeddedForm($key)->doMassAction($user_id, $this->getValue('item_list'), $actions_values[$key]);
             }
         }
         if ($group_action) {
             $query->execute();
         }
     }
 }
開發者ID:naturalsciences,項目名稱:Darwin,代碼行數:25,代碼來源:BaseMassActionForm.class.php

示例3: countProyectos

 public function countProyectos(Doctrine_Query $q = null)
 {
     if (is_null($q)) {
         $q = Doctrine_Query::create()->from('ProyectoLey p');
     }
     return $q->count();
 }
開發者ID:votainteligente,項目名稱:legislativo,代碼行數:7,代碼來源:ProyectoLeyTable.class.php

示例4: save

 public function save(Doctrine_Connection $conn = null)
 {
     try {
         $this->setIsTosync(1);
         parent::save($conn);
         if ($this->getGainId() != null) {
             $send_email_visiteur_template_id = $this->getGain()->getSendEmailVisiteurTemplateId();
             $send_email_admin_template_id = $this->getGain()->getSendEmailAdminTemplateId();
             if ($send_email_visiteur_template_id || $send_email_admin_template_id) {
                 $visiteur = Doctrine_Core::getTable('Visiteur')->findOneBy('guid', $this->getVisiteurId());
                 $gain = $this->getGain();
                 $univers_status = $this->getUniversStatus();
                 $visiteur_email = $visiteur->getEmail();
                 $admin_email = sfConfig::get('app_gain_admin_email', null);
                 $array_replace = array('$visiteur_pseudo' => $visiteur->getPseudoSon(), '$visiteur_nom' => $visiteur->getNom(), '$visiteur_prenom' => $visiteur->getPrenom(), '$visiteur_adresse1' => $visiteur->getAdresse(), '$visiteur_adresse2' => $visiteur->getAdresse2(), '$visiteur_cp' => $visiteur->getCodePostal(), '$visiteur_ville' => $visiteur->getVille(), '$visiteur_num_mobile' => $visiteur->getNumMobile(), '$visiteur_email' => $visiteur->getEmail(), '$host_image_src' => sfConfig::get('app_host_image_src'), '$gain_libelle' => $gain->getLibelle(), '$gain_image' => $gain->getImage(), '$gain_description' => $gain->getDescription(), '$gain_start_at' => $gain->getStartAt(), '$gain_end_at' => $gain->getEndAt(), '$univers_status_level' => $univers_status->getLevel(), '$univers_status_level_name' => $univers_status->getLevelName(), '$univers_status_description' => $univers_status->getDescription(), '$univers_status_libelle' => $univers_status->getLibelle());
             }
             // envoi d'un email au visiteur
             if ($send_email_visiteur_template_id && $visiteur_email) {
                 $template = Doctrine_Query::create()->from('TemplateMail t')->where('t.guid = ?', $send_email_visiteur_template_id)->fetchOne();
                 if ($template !== false) {
                     $template->sendEmail($visiteur_email, $array_replace);
                 }
             }
             // envoi d'un email a l'admin
             if ($send_email_admin_template_id && $admin_email) {
                 $template = Doctrine_Query::create()->from('TemplateMail t')->where('t.guid = ?', $send_email_admin_template_id)->fetchOne();
                 if ($template !== false) {
                     $template->sendEmail($admin_email, $array_replace);
                 }
             }
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
開發者ID:pmoutet,項目名稱:navinum,代碼行數:35,代碼來源:VisiteurUniversStatusGain.class.php

示例5: get_district_name_

 public static function get_district_name_($district)
 {
     $query = Doctrine_Query::create()->select("*")->from("districts")->where("id='{$district}'");
     $drugs = $query->execute();
     $drugs = $drugs->toArray();
     return $drugs[0];
 }
開發者ID:HCMPKenya,項目名稱:HCMP-ALPHA,代碼行數:7,代碼來源:districts.php

示例6: executeBulk

 public function executeBulk(sfWebRequest $request)
 {
     $ids = array_keys($request->getParameter('rl-check', array()));
     $query = Doctrine_Query::create();
     $query->update('Role r')->set('deleted_at', '?', date('Y-m-d H:i:s'))->whereIn('r.id', $ids)->andWhere('it.account_id = ?', $this->getUser()->getAttribute('account_id'))->execute();
     $this->redirect('adminRole/list');
 }
開發者ID:newZinc,項目名稱:timehive,代碼行數:7,代碼來源:actions.class.php

示例7: testTest

 public function testTest()
 {
     $q = Doctrine_Query::create()->select('u.*, CONCAT(u.id, u.name) as custom')->from('User u INDEXBY custom');
     $this->assertEqual($q->getSqlQuery(), 'SELECT e.id AS e__id, e.name AS e__name, e.loginname AS e__loginname, e.password AS e__password, e.type AS e__type, e.created AS e__created, e.updated AS e__updated, e.email_id AS e__email_id, CONCAT(e.id, e.name) AS e__0 FROM entity e WHERE (e.type = 0)');
     $results = $q->fetchArray();
     $this->assertEqual($results['4zYne']['name'], 'zYne');
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:7,代碼來源:1494TestCase.php

示例8: getComments

 /**
  * Get comments for a specific module and spec entry
  * @param string $module
  * @param array||int $key
  * @return array -> objects
  */
 public function getComments($module, $key)
 {
     // If the key isn't an array (directly the integer)
     if (!is_array($key)) {
         // Encaspluate the key in a array
         $key = array($key);
     }
     switch ($module) {
         case "forums":
             $column = "tid";
             break;
         case "up":
             $column = "upid";
             break;
         case "sht":
             $column = "shtid";
             break;
         case "pm":
             $column = "pmid";
             break;
         case "poll":
             $column = "pollid";
             break;
         case "news":
             $column = "nwsid";
             break;
     }
     // Execute & return the request
     return Doctrine_Query::create()->select("m.*, v.*, u.username, u.avatar, u.slug, uu.username, uu.avatar, uu.slug")->from("MsgMessages m")->leftJoin("m.MsgVotes v")->leftJoin('m.Users u')->leftJoin('v.Users uu')->where('m.module = ?', $module)->andWhereIn('m.' . $column, $key)->useQueryCache(true)->setQueryCacheLifeSpan(3600 * 24)->execute();
 }
開發者ID:thefkboss,項目名稱:ZenTracker,代碼行數:36,代碼來源:MsgMessagesTable.class.php

示例9: execute

 /**
  * execute
  *
  * @param string $value
  * @param string $error
  * @return void
  */
 public function execute(&$value, &$error)
 {
     $className = $this->getParameter('class');
     $columnName = $className . '.' . $this->getParameter('column');
     $primaryKeys = Doctrine::getTable($className)->getIdentifier();
     if (!is_array($primaryKeys)) {
         $primaryKeys = array($primaryKeys);
     }
     // implied assumption: the is at least one primary key
     foreach ($primaryKeys as $primaryKey) {
         if (is_null($primaryKeyValue = $this->getContext()->getRequest()->getParameter($primaryKey))) {
             break;
         }
     }
     $query = Doctrine_Query::create()->from($className);
     if ($primaryKeyValue == null) {
         $query->where($columnName . ' = ?');
         $res = $query->execute(array($value));
     } else {
         $query->where($columnName . ' = ? AND ' . $primaryKey . ' != ?');
         $res = $query->execute(array($value, $primaryKeyValue));
     }
     if ($res->count()) {
         $error = $this->getParameterHolder()->get('unique_error');
         return false;
     }
     return true;
 }
開發者ID:JimmyVB,項目名稱:Symfony-v1.2,代碼行數:35,代碼來源:sfDoctrineUniqueValidator.class.php

示例10: testInheritanceSubclasses

 public function testInheritanceSubclasses()
 {
     $records = Doctrine_Query::create()->query('FROM Parent1713 m');
     foreach ($records as $rec) {
         $this->assertEqual(get_class($rec), $rec['title']);
     }
 }
開發者ID:ninjapenguin,項目名稱:kohana-Doctrine-module,代碼行數:7,代碼來源:1713TestCase.php

示例11: testTicket

 public function testTicket()
 {
     $q = Doctrine_Query::create()->from('T1500_User u')->innerJoin('u.Group g')->where('u.id = 1');
     $this->assertEqual($q->getSqlQuery(), 'SELECT t.user_id AS t__user_id, t.group_id AS t__group_id, t.name AS t__name, t2.group_id AS t2__group_id, t2.name AS t2__name FROM t1500__user t INNER JOIN t1500__group t2 ON t.group_id = t2.group_id WHERE t.user_id = 1');
     $q = Doctrine_Query::create()->from('T1500_Group g')->innerJoin('g.Users u')->where('g.id = 1');
     $this->assertEqual($q->getSqlQuery(), 'SELECT t.group_id AS t__group_id, t.name AS t__name, t2.user_id AS t2__user_id, t2.group_id AS t2__group_id, t2.name AS t2__name FROM t1500__group t INNER JOIN t1500__user t2 ON t.group_id = t2.group_id WHERE t.group_id = 1');
 }
開發者ID:swk,項目名稱:bluebox,代碼行數:7,代碼來源:1500TestCase.php

示例12: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         try {
             $peticion = $form->save();
             $aux = Doctrine_Query::create()->from('sfGuardUser s')->where('s.email_address = ?', $peticion->getEmailAddress());
             $aux1 = $aux->fetchOne();
             if (!$aux1) {
                 $auxU = Doctrine_Query::create()->from('sfGuardUser s')->where('s.username = ?', $peticion->getUsername());
                 $auxU1 = $auxU->fetchOne();
                 if (!$auxU1) {
                     $this->redirect('peticion/notificacion');
                 } else {
                     $peticion->delete();
                     $this->getUser()->setFlash('error', 'El nombre de usuario "' . $peticion->getUsername() . '" no esta disponible.', false);
                 }
             } else {
                 $peticion->delete();
                 $this->getUser()->setFlash('error', 'El correo electrónico "' . $peticion->getEmailAddress() . '" ya se encuentra registrado.', false);
             }
         } catch (Exception $e) {
             $this->getUser()->setFlash('error', 'El correo electrónico ingresado ya se encuentra registrado.', false);
         }
     }
 }
開發者ID:edulima1989,項目名稱:Sistema-Radiotaxi,代碼行數:26,代碼來源:actions.class.php

示例13: deleteCategory

 /**
  * @todo Execute deleteUser function for delete the particular user based on parameter.
  *
  * @param $snIdUser  Integer UserId.
  * @return type array or boolean.
  */
 public static function deleteCategory($snIdUser)
 {
     if ($snIdUser == "" || !is_numeric($snIdUser)) {
         return false;
     }
     return Doctrine_Query::create()->delete("Model_Category MU")->where("id_category = ?", $snIdUser)->execute();
 }
開發者ID:nainit-virtueinfo,項目名稱:zend-rest,代碼行數:13,代碼來源:Model_CategoryTable.php

示例14: getFeedEntries

 public static function getFeedEntries($uid = null, $actorid = null, $friends = false, $actions = true, $stories = true)
 {
     $q = Doctrine_Query::create();
     if (isset($actorid) && !empty($actorid)) {
         $_whereClause = "feed.actor_id = {$actorid}";
     } else {
         if (isset($uid) && !empty($uid)) {
             if ($friends) {
                 $_whereClause = "friend.from_id = '{$uid}' and feed.author_id = friend.to_id";
             } else {
                 if (!empty($_whereClause)) {
                     $_whereClause .= ' and ';
                 }
                 $_whereClause = "feed.author_id = '{$uid}'";
             }
         }
     }
     if (!$actions || !$stories) {
         $_type = empty($actions) ? '1' : '2';
         $_whereClause .= ' and feed.type = ' . $_type;
     }
     //		error_log( 'where clause: ' . $_whereClause );
     $q->select(self::getSelect($friends))->from(self::getFrom($uid, $actorid, $friends))->where($_whereClause)->orderby('feed.created desc');
     return $q->execute()->toArray(true);
 }
開發者ID:jkinner,項目名稱:ringside,代碼行數:25,代碼來源:Feed.php

示例15: testSavingUnmodifiedRecordsDoesNotInvokeTimestampableListener

 public function testSavingUnmodifiedRecordsDoesNotInvokeTimestampableListener()
 {
     $this->conn->clear();
     $wiki = Doctrine_Query::create()->from('Wiki w')->where('w.id = 1')->fetchOne();
     $wiki->save();
     $this->assertEqual($wiki->Translation['FI']->version, 2);
 }
開發者ID:ninjapenguin,項目名稱:kohana-Doctrine-module,代碼行數:7,代碼來源:PluginTestCase.php


注:本文中的Doctrine_Query::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。