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


PHP Doctrine_Query::free方法代码示例

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


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

示例1: testTicket

 public function testTicket()
 {
     $q = new Doctrine_Query();
     // simple query with deep relations
     $q->addSelect('Resume.id, Level.id, Level.label')->from('ticket384_Resume Resume')->leftJoin('Resume.KnownLanguages KnownLanguages')->leftJoin('KnownLanguages.Level Level')->leftJoin('KnownLanguages.Language Language');
     try {
         // get the wrong resultset
         $aResult = $q->fetchArray();
         $this->fail();
     } catch (Doctrine_Query_Exception $e) {
         $this->pass();
     }
     $q->free();
     // now correct
     // we have to select at least KnownLanguages.id in order to get the Levels,
     // which are only reachable through the KnownLanguages, hydrated properly.
     $q = new Doctrine_Query();
     $q->addSelect('Resume.id, Level.id, Level.label, KnownLanguages.id')->from('ticket384_Resume Resume')->leftJoin('Resume.KnownLanguages KnownLanguages')->leftJoin('KnownLanguages.Level Level')->leftJoin('KnownLanguages.Language Language');
     $aResult = $q->fetchArray();
     // should be setted
     $bSuccess = isset($aResult[0]['KnownLanguages'][0]['Level']);
     $this->assertTrue($bSuccess);
     if (!$bSuccess) {
         $this->fail('fetchArray doesnt hydrate nested child relations, if parent doesnt have a column selected');
     }
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:26,代码来源:384TestCase.php

示例2: query

 /**
  * query
  * queries the database using Doctrine Query Language
  * returns a collection of Doctrine_Record objects
  *
  * <code>
  * $users = $conn->query('SELECT u.* FROM User u');
  *
  * $users = $conn->query('SELECT u.* FROM User u WHERE u.name LIKE ?', array('someone'));
  * </code>
  *
  * @param string $query             DQL query
  * @param array $params             query parameters
  * @param int $hydrationMode        Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD
  * @see Doctrine_Query
  * @return Doctrine_Collection      Collection of Doctrine_Record objects
  */
 public function query($query, array $params = array(), $hydrationMode = null)
 {
     $parser = new Doctrine_Query($this);
     $res = $parser->query($query, $params, $hydrationMode);
     $parser->free();
     return $res;
 }
开发者ID:adnanali,项目名称:munch,代码行数:24,代码来源:Connection.php

示例3: testQueryCacheLifeSpan

 public function testQueryCacheLifeSpan()
 {
     // initially NULL = not cached
     $q = new Doctrine_Query();
     $this->assertIdentical(null, $q->getQueryCacheLifeSpan());
     $q->free();
     // 0 = forever
     $this->manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 0);
     $q = new Doctrine_Query();
     $this->assertIdentical(0, $q->getQueryCacheLifeSpan());
     $q->free();
     $this->manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 3600);
     $q = new Doctrine_Query();
     $this->assertIdentical(3600, $q->getQueryCacheLifeSpan());
     $q->free();
     // test that value set on connection level has precedence
     $this->conn->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE_LIFESPAN, 42);
     $q = new Doctrine_Query();
     $this->assertIdentical(42, $q->getQueryCacheLifeSpan());
     $q->free();
     // test that value set on the query has highest precedence
     $q = new Doctrine_Query();
     $q->setQueryCacheLifeSpan(4321);
     $this->assertIdentical(4321, $q->getQueryCacheLifeSpan());
     $q->free();
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:26,代码来源:CacheTestCase.php

示例4: executeSitemap

 public function executeSitemap()
 {
     $urls = array();
     $home = array();
     $home['url'] = Tools::get('url');
     $home['priority'] = 1.0;
     $home['changefreq'] = 'daily';
     $urls[] = $home;
     $latest = 0;
     $q = new Doctrine_Query();
     $themes = $q->select('t.*')->from('Theme t')->addWhere('t.approved = ?', array(true))->orderby('t.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_theme = 0;
     $theme_home = array();
     $theme_home['url'] = Tools::get('url') . '/theme';
     $theme_home['priority'] = 1.0;
     $theme_home['changefreq'] = 'daily';
     $urls[] = $theme_home;
     $application_home = array();
     $application_home['url'] = Tools::get('url') . '/application';
     $application_home['priority'] = 1.0;
     $application_home['changefreq'] = 'daily';
     $urls[] = $application_home;
     $module_home = array();
     $module_home['url'] = Tools::get('url') . '/module';
     $module_home['priority'] = 1.0;
     $module_home['changefreq'] = 'daily';
     $urls[] = $module_home;
     $user_home = array();
     $user_home['url'] = Tools::get('url') . '/user';
     $user_home['priority'] = 1.0;
     $user_home['changefreq'] = 'daily';
     $urls[] = $user_home;
     foreach ($themes as $theme) {
         $url = array();
         $url['url'] = Tools::get('url') . '/theme/show/' . $theme->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $theme->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($theme->getUpdatedAt());
         if ($current > $latest_theme) {
             $latest_theme = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $themes->free();
     $urls[1]['lastmod'] = date('r', $latest_theme);
     $q = new Doctrine_Query();
     $applications = $q->select('a.*')->from('Application a')->addWhere('a.approved = ?', array(true))->orderby('a.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_application = 0;
     foreach ($applications as $application) {
         $url = array();
         $url['url'] = Tools::get('url') . '/application/show/' . $application->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $application->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($application->getUpdatedAt());
         if ($current > $latest_application) {
             $latest_application = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $applications->free();
     $urls[2]['lastmod'] = date('r', $latest_application);
     $q = new Doctrine_Query();
     $modules = $q->select('m.*')->from('Madule m')->addWhere('m.approved = ?', array(true))->orderby('m.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_module = 0;
     foreach ($modules as $module) {
         $url = array();
         $url['url'] = Tools::get('url') . '/module/show/' . $module->getId();
         $url['priority'] = 0.5;
         $url['changefreq'] = 'daily';
         $url['lastmod'] = $module->getUpdatedAt();
         $urls[] = $url;
         $current = strtotime($module->getUpdatedAt());
         if ($current > $latest_module) {
             $latest_module = $current;
         }
         if ($current > $latest) {
             $latest = $current;
         }
     }
     $modules->free();
     $urls[3]['lastmod'] = date('r', $latest_module);
     $q = new Doctrine_Query();
     $users = $q->select('u.*')->from('User u')->addWhere('u.active = ?', array(true))->orderby('u.updated_at desc')->limit(50)->execute();
     $q->free();
     $latest_user = 0;
     foreach ($users as $user) {
         $url = array();
         $url['url'] = Tools::get('url') . '/user/show/' . $user->getId();
         $url['priority'] = 0.5;
//.........这里部分代码省略.........
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:101,代码来源:actions.class.php


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