锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲情综合五月天,老司机亚洲精品影院无码,亚洲欧洲日韩国产综合在线二区http://m.tkk7.com/programmer/category/27885.htmlzh-cnFri, 07 Dec 2007 06:21:31 GMTFri, 07 Dec 2007 06:21:31 GMT60How To: Using symfony to add a join between tableshttp://m.tkk7.com/programmer/archive/2007/12/05/165599.htmlwadewadeWed, 05 Dec 2007 09:26:00 GMThttp://m.tkk7.com/programmer/archive/2007/12/05/165599.htmlhttp://m.tkk7.com/programmer/comments/165599.htmlhttp://m.tkk7.com/programmer/archive/2007/12/05/165599.html#Feedback0http://m.tkk7.com/programmer/comments/commentRss/165599.htmlhttp://m.tkk7.com/programmer/services/trackbacks/165599.html1. simple join two tables

purpose:
generate sql like:   

select * from photo p
    left join artist a on p.artist_id = a.artist_id
      where a.genre = 'something' and p.genre = 'something'

code:           

if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
    $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
}
$criteria->add(ArtistPeer::GENRE, $genre);    
$criteria->add(PhotoPeer::GENRE, $genre);

2. join two tables, add AND OR between conditions
purpose:
generate sql like:    

select * from photo p
    left join artist a on p.artist_id = a.artist_id
      where (a.genre = 'some' or p.genre='something')
        and a.name = 'something'

code:   

if(!CriteriaUtil::hasJoin($criteria, ArtistPeer::TABLE_NAME)){
   $criteria->addJoin(PhotoPeer::ARTIST_ID, ArtistPeer::ARTIST_ID, Criteria::LEFT_JOIN);
}
$criteria->add(ArtistPeer::GENRE, $genre);
$c = $criteria->getCriterion(ArtistPeer::GENRE);
if($c != null){
   $c->addOr($criteria->getNewCriterion(PhotoPeer::GENRE, $genre));
}
$criteria->add(ArtistPeer::NAME, $name);

 

Note:
It's a good habit to check if we have joined the table already. to check this, you can use the following util class, it get all the joined tables, and check if the table exists in them.

class CriteriaUtil{
    public static function hasJoin($c, $table_name){
        $joins = $c->getJoins();
        if($joins != null){
            foreach($joins as $join){
                if($join->getRightTableName() == $table_name){
                    return true;
                }
                if($join->getLeftTableName() == $table_name){
                    return true;
                }
            }
        }
        return false;
    }
}


wade 2007-12-05 17:26 鍙戣〃璇勮
]]>
How To: Clear cache for symfonyhttp://m.tkk7.com/programmer/archive/2007/11/13/165571.htmlwadewadeTue, 13 Nov 2007 09:23:00 GMThttp://m.tkk7.com/programmer/archive/2007/11/13/165571.htmlhttp://m.tkk7.com/programmer/comments/165571.htmlhttp://m.tkk7.com/programmer/archive/2007/11/13/165571.html#Feedback0http://m.tkk7.com/programmer/comments/commentRss/165571.htmlhttp://m.tkk7.com/programmer/services/trackbacks/165571.htmlOriginal article: http://www.symfony-project.com/book/1_0/18-Performance

Clearing Selective Parts of the Cache

During application development, you have to clear the cache in various situations:

  • When you create a new class: Adding a class to an autoloading directory (one of the project's lib/ folders) is not enough to have symfony find it automatically. You must clear the autoloading configuration cache so that symfony browses again all the directories of the autoload.yml file and references the location of autoloadable classes--including the new ones.
  • When you change the configuration in production: The configuration is parsed only during the first request in production. Further requests use the cached version instead. So a change in the configuration in the production environment (or any environment where SF_DEBUG is turned off) doesn't take effect until you clear the cached version of the file.
  • When you modify a template in an environment where the template cache is enabled: The valid cached templates are always used instead of existing templates in production, so a template change is ignored until the template cache is cleared or outdated.
  • When you update an application with the sync command: This case usually covers the three previous modifications.

The problem with clearing the whole cache is that the next request will take quite long to process, because the configuration cache needs to be regenerated. Besides, the templates that were not modified will be cleared from the cache as well, losing the benefit of previous requests.

That means it's a good idea to clear only the cache files that really need to be regenerated. Use the options of the clear-cache task to define a subset of cache files to clear, as demonstrated in Listing 18-14.

Listing 18-14 - Clearing Only Selective Parts of the Cache

// Clear only the cache of the myapp application
> symfony clear-cache myapp

// Clear only the HTML cache of the myapp application
> symfony clear-cache myapp template

// Clear only the configuration cache of the myapp application
> symfony clear-cache myapp config

You can also remove files by hand in the cache/ directory, or clear template cache files selectively from the action with the $cacheManager->remove() method, as described inChapter 12

 

Note:

1. We can use $cacheManager->remove() to clear cache after we deployed a new version product.

2. write code to generate models from database, and then call $cacheManager->remove() to clear cache.


 


wade 2007-11-13 17:23 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲国产模特在线播放| 免费很黄无遮挡的视频毛片| 国产成人亚洲合集青青草原精品 | 久久亚洲高清综合| 国产性爱在线观看亚洲黄色一级片| 亚洲人成影院在线无码按摩店| 韩国免费三片在线视频| 亚洲国产成人VA在线观看| 亚洲国产精品无码久久一区二区| 91天堂素人精品系列全集亚洲| 亚洲中文字幕成人在线| 亚洲2022国产成人精品无码区| 在线观看午夜亚洲一区| 久久狠狠高潮亚洲精品| 亚洲黄色免费网站| 亚洲人成网站免费播放| 国产高潮流白浆喷水免费A片 | 91精品国产免费| 四虎国产精品免费视| 亚洲国产高清在线| 亚洲中文字幕无码久久2020 | 日本特黄特黄刺激大片免费| 内射无码专区久久亚洲| 国产国拍亚洲精品福利 | 久久精品熟女亚洲av麻豆 | 亚洲午夜一区二区三区| 草久免费在线观看网站| 一级看片免费视频| 2021在线观看视频精品免费| 日本免费网站观看| 亚洲成在人天堂在线| 亚洲AV无码一区二区三区电影 | 全部一级一级毛片免费看| 99在线观看视频免费| 100部毛片免费全部播放完整| 国产精品无码一区二区三区免费 | 亚洲欧美aⅴ在线资源| APP在线免费观看视频| 国产好大好硬好爽免费不卡| 9420免费高清在线视频| 亚洲第一区在线观看|