Changeset 4706

Show
Ignore:
Timestamp:
07/23/08 22:21:13 (4 months ago)
Author:
guilhermeblanco
Message:

Fixes #1268 and fixes #1260. Fixed test case of #1250. Updated documentation to support changes. Remove BC break of fetchTree and also Pager is now aware of Hydration mode defined in Query object.

Location:
branches
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Pager.php

    r4398 r4706  
    562562     * 
    563563     * @param $params               Optional parameters to Doctrine_Query::execute 
    564      * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute  
    565      *                              returned ResultSet. Doctrine::Default is FETCH_RECORD 
     564     * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute returned ResultSet. 
    566565     * @return Doctrine_Collection  The root collection 
    567566     */ 
    568     public function execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD) 
     567    public function execute($params = array(), $hydrationMode = null) 
    569568    { 
    570569        if (!$this->getExecuted()) { 
  • branches/0.11/lib/Doctrine/Pager/Layout.php

    r4252 r4706  
    124124     * 
    125125     * @param $params               Optional parameters to Doctrine_Query::execute 
    126      * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute  
    127      *                              returned ResultSet. Doctrine::Default is FETCH_RECORD 
     126     * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute returned ResultSet. 
    128127     * @return Doctrine_Collection  The root collection 
    129128     */ 
    130     public function execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD) 
     129    public function execute($params = array(), $hydrationMode = null) 
    131130    { 
    132131        return $this->getPager()->execute($params, $hydrationMode); 
  • branches/0.11/lib/Doctrine/Tree/Interface.php

    r4656 r4706  
    5151     * 
    5252     * @param array $options                    options 
    53      * @param integer $fetchmode  One of the Doctrine::HYDRATE_* constants. 
     53     * @param integer $fetchmode                One of the Doctrine::HYDRATE_* constants. 
    5454     * @return object $iterator                 instance of Doctrine_Node_<Implementation>_PreOrderIterator 
    5555     */ 
    56     public function fetchTree($options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD); 
     56    public function fetchTree($options = array(), $hydrationMode = null); 
    5757 
    5858    /** 
     
    6161     * @param mixed $pk                         primary key as used by table::find() to locate node to traverse tree from 
    6262     * @param array $options                    options 
    63      * @param 
     63     * @param integer $fetchmode                One of the Doctrine::HYDRATE_* constants. 
    6464     * @return iterator                         instance of Doctrine_Node_<Implementation>_PreOrderIterator 
    6565     */ 
    66     public function fetchBranch($pk, $options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD); 
     66    public function fetchBranch($pk, $options = array(), $hydrationMode = null); 
    6767} 
  • branches/0.11/lib/Doctrine/Tree/NestedSet.php

    r4656 r4706  
    159159        } 
    160160 
    161         $q = $this->returnQueryWithRootId($q, $rootId)->setHydrationMode($hydrationMode); 
     161        $q = $this->returnQueryWithRootId($q, $rootId); 
     162         
     163        // FIX: Reported in ticket #1268 
     164        if ($hydrationMode !== null) { 
     165            $q = $q->setHydrationMode($hydrationMode); 
     166        } 
     167 
    162168        $tree = $q->execute(); 
    163169 
     
    191197        $q->addWhere($this->_baseAlias . ".lft >= ? AND " . $this->_baseAlias . ".rgt <= ?", $params) 
    192198                ->addOrderBy($this->_baseAlias . ".lft asc"); 
    193         $q = $this->returnQueryWithRootId($q, $record->getNode()->getRootValue()) 
    194             ->setHydrationMode($hydrationMode); 
     199        $q = $this->returnQueryWithRootId($q, $record->getNode()->getRootValue()); 
     200         
     201        // FIX: Reported in ticket #1268 
     202        if ($hydrationMode !== null) { 
     203            $q = $q->setHydrationMode($hydrationMode); 
     204        } 
     205 
    195206        return $q->execute(); 
    196207    } 
  • branches/0.11/manual/docs/en/utilities/pagination/advanced-layouts-with-pager.txt

    r4159 r4706  
    157157 
    158158// Handy method to execute the query without need to retrieve the Pager instance 
    159 $pager_layout->execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD); 
     159$pager_layout->execute($params = array(), $hydrationMode = null); 
    160160</code> 
    161161 
  • branches/0.11/manual/docs/en/utilities/pagination/working-with-pager.txt

    r4398 r4706  
    3636 
    3737<code type="php"> 
    38 $items = $pager->execute([$args = array() [, $fetchType = Doctrine::FETCH_RECORD]]); 
     38$items = $pager->execute([$args = array() [, $fetchType = null]]); 
    3939 
    4040foreach ($items as $item) { 
  • branches/1.0/docs/manual/en/utilities/pagination/advanced-layouts-with-pager.txt

    r4674 r4706  
    157157 
    158158// Handy method to execute the query without need to retrieve the Pager instance 
    159 $pager_layout->execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD); 
     159$pager_layout->execute($params = array(), $hydrationMode = null); 
    160160</code> 
    161161 
  • branches/1.0/docs/manual/en/utilities/pagination/working-with-pager.txt

    r4674 r4706  
    3636 
    3737<code type="php"> 
    38 $items = $pager->execute([$args = array() [, $fetchType = Doctrine::FETCH_RECORD]]); 
     38$items = $pager->execute([$args = array() [, $fetchType = null]]); 
    3939 
    4040foreach ($items as $item) { 
  • branches/1.0/lib/Doctrine/Pager.php

    r4398 r4706  
    562562     * 
    563563     * @param $params               Optional parameters to Doctrine_Query::execute 
    564      * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute  
    565      *                              returned ResultSet. Doctrine::Default is FETCH_RECORD 
     564     * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute returned ResultSet. 
    566565     * @return Doctrine_Collection  The root collection 
    567566     */ 
    568     public function execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD) 
     567    public function execute($params = array(), $hydrationMode = null) 
    569568    { 
    570569        if (!$this->getExecuted()) { 
    571570            $this->_initialize($params); 
    572571        } 
    573  
     572         
    574573        return $this->getQuery()->execute($params, $hydrationMode); 
    575574    } 
  • branches/1.0/lib/Doctrine/Pager/Layout.php

    r4252 r4706  
    124124     * 
    125125     * @param $params               Optional parameters to Doctrine_Query::execute 
    126      * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute  
    127      *                              returned ResultSet. Doctrine::Default is FETCH_RECORD 
     126     * @param $hydrationMode        Hydration Mode of Doctrine_Query::execute returned ResultSet. 
    128127     * @return Doctrine_Collection  The root collection 
    129128     */ 
    130     public function execute($params = array(), $hydrationMode = Doctrine::FETCH_RECORD) 
     129    public function execute($params = array(), $hydrationMode = null) 
    131130    { 
    132131        return $this->getPager()->execute($params, $hydrationMode); 
  • branches/1.0/lib/Doctrine/Tree/Interface.php

    r4656 r4706  
    5454     * @return object $iterator                 instance of Doctrine_Node_<Implementation>_PreOrderIterator 
    5555     */ 
    56     public function fetchTree($options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD); 
     56    public function fetchTree($options = array(), $hydrationMode = null); 
    5757 
    5858    /** 
     
    6161     * @param mixed $pk                         primary key as used by table::find() to locate node to traverse tree from 
    6262     * @param array $options                    options 
    63      * @param 
     63     * @param integer $fetchmode                One of the Doctrine::HYDRATE_* constants. 
    6464     * @return iterator                         instance of Doctrine_Node_<Implementation>_PreOrderIterator 
    6565     */ 
    66     public function fetchBranch($pk, $options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD); 
     66    public function fetchBranch($pk, $options = array(), $hydrationMode = null); 
    6767} 
  • branches/1.0/lib/Doctrine/Tree/NestedSet.php

    r4656 r4706  
    143143     * @return mixed          The tree or FALSE if the tree could not be found. 
    144144     */ 
    145     public function fetchTree($options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) 
     145    public function fetchTree($options = array(), $hydrationMode = null) 
    146146    { 
    147147        // fetch tree 
     
    159159        } 
    160160 
    161         $q = $this->returnQueryWithRootId($q, $rootId)->setHydrationMode($hydrationMode); 
     161        $q = $this->returnQueryWithRootId($q, $rootId); 
     162 
     163        // FIX: Reported in ticket #1268 
     164        if ($hydrationMode !== null) { 
     165            $q = $q->setHydrationMode($hydrationMode); 
     166        } 
     167 
    162168        $tree = $q->execute(); 
    163169 
     
    178184     * @todo Only fetch the lft and rgt values of the initial record. more is not needed. 
    179185     */ 
    180     public function fetchBranch($pk, $options = array(), $hydrationMode = Doctrine::HYDRATE_RECORD) 
     186    public function fetchBranch($pk, $options = array(), $hydrationMode = null) 
    181187    { 
    182188        $record = $this->table->find($pk); 
     
    191197        $q->addWhere($this->_baseAlias . ".lft >= ? AND " . $this->_baseAlias . ".rgt <= ?", $params) 
    192198                ->addOrderBy($this->_baseAlias . ".lft asc"); 
    193         $q = $this->returnQueryWithRootId($q, $record->getNode()->getRootValue()) 
    194             ->setHydrationMode($hydrationMode); 
     199        $q = $this->returnQueryWithRootId($q, $record->getNode()->getRootValue()); 
     200         
     201        // FIX: Reported in ticket #1268 
     202        if ($hydrationMode !== null) { 
     203            $q = $q->setHydrationMode($hydrationMode); 
     204        } 
     205 
    195206        return $q->execute(); 
    196207    } 
  • branches/1.0/tests/Ticket/1250TestCase.php

    r4688 r4706  
    4040     try { 
    4141        $r = new Doctrine_Ticket_1250_i18n(); 
     42        // This is needed since all fields are internationalized. 
     43        // Reason for not fixing that is BC. Manual describes this behavior very well 
     44        $r->state('TDIRTY'); 
    4245        $r->Translation['en']->title = 'Title in english'; 
    4346        $r->Translation['en']->content = 'Content in english';