Changeset 1591

Show
Ignore:
Timestamp:
03/02/10 20:57:59 (10 days ago)
Author:
francois
Message:

[1.5] Introducing the query_cache behavior

Location:
branches/1.5
Files:
3 added
4 modified

Legend:

Unmodified
Added
Removed
  • branches/1.5/docs/guide/07-Behaviors.txt

    r1539 r1591  
    136136== Bundled Behaviors == 
    137137 
    138 Propel currently bundles eight behaviors. Check the behavior documentation for details on usage: 
     138Propel currently bundles nine behaviors. Check the behavior documentation for details on usage: 
    139139 
    140140 * [wiki:Users/Documentation/1.5/Behaviors/alternative_coding_standards alternative_coding_standards] 
     
    145145 * [wiki:Users/Documentation/1.5/Behaviors/sortable sortable] 
    146146 * [wiki:Users/Documentation/1.5/Behaviors/nested_set nested_set] 
     147 * [wiki:Users/Documentation/1.5/Behaviors/query_cache query_cache] 
    147148 * And [wiki:Users/Documentation/1.5/Inheritance#ConcreteTableInheritance concrete_inheritance], documented in the Inheritance Chapter even if it's a behavior 
    148149 
  • branches/1.5/generator/default.properties

    r1545 r1591  
    255255propel.behavior.sluggable.class = behavior.sluggable.SluggableBehavior 
    256256propel.behavior.concrete_inheritance.class = behavior.concrete_inheritance.ConcreteInheritanceBehavior 
     257propel.behavior.query_cache.class = behavior.query_cache.QueryCacheBehavior 
  • branches/1.5/runtime/lib/query/Criteria.php

    r1586 r1591  
    210210 
    211211  /** 
    212    * Get the criteria map. 
     212   * Get the criteria map, i.e. the array of Criterions 
    213213   * @return     array 
    214214   */ 
     
    408408  public function getCriterion($column) 
    409409  { 
    410     if ( isset ( $this->map[$column] ) ) { 
    411       return $this->map[$column]; 
    412     } 
    413     return null; 
     410    return $this->map[$column]; 
    414411  } 
    415412   
     
    11191116    return $this->having; 
    11201117  } 
    1121  
     1118   
    11221119  /** 
    11231120   * Remove an object from the criteria. 
  • branches/1.5/runtime/lib/query/ModelCriteria.php

    r1587 r1591  
    15421542    return $this->containsKey($key) ? $this->addAnd($key, $value, $comparison) : $this->add($key, $value, $comparison); 
    15431543  } 
     1544   
     1545  /** 
     1546   * Get all the parameters to bind to this criteria 
     1547   * Does part of the job of BasePeer::createSelectSql() for the cache 
     1548   * 
     1549   * @return    array list of parameters, each parameter being an array like 
     1550   *                  array('table' => $realtable, 'column' => $column, 'value' => $value) 
     1551   */ 
     1552  public function getParams() 
     1553  { 
     1554    $params = array(); 
     1555    $dbMap = Propel::getDatabaseMap($this->getDbName()); 
     1556 
     1557    foreach ($this->getMap() as $criterion) { 
     1558 
     1559      $table = null; 
     1560      foreach ($criterion->getAttachedCriterion() as $attachedCriterion) { 
     1561        $tableName = $attachedCriterion->getTable(); 
     1562 
     1563        $table = $this->getTableForAlias($tableName); 
     1564        if (null === $table) { 
     1565          $table = $tableName; 
     1566        } 
     1567 
     1568        if (($this->isIgnoreCase() || $attachedCriterion->isIgnoreCase()) 
     1569        && $dbMap->getTable($table)->getColumn($attachedCriterion->getColumn())->isText()) { 
     1570          $attachedCriterion->setIgnoreCase(true); 
     1571        } 
     1572      } 
     1573 
     1574      $sb = ''; 
     1575      $criterion->appendPsTo($sb, $params); 
     1576    } 
     1577 
     1578    $having = $this->getHaving(); 
     1579    if ($having !== null) { 
     1580      $sb = ''; 
     1581      $having->appendPsTo($sb, $params); 
     1582    } 
     1583 
     1584    return $params; 
     1585  } 
    15441586 
    15451587  /**