Changeset 4744

Show
Ignore:
Timestamp:
08/07/08 16:03:54 (5 months ago)
Author:
jwage
Message:

fixes #1112

Location:
branches/1.0/lib/Doctrine/Parser
Files:
5 added
1 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Parser/Yml.php

    r4114 r4744  
    2929 * @since       1.0 
    3030 * @version     $Revision: 1080 $ 
    31  * @author      Jonathan H. Wage <jwage@mac.com> 
     31 * @author      Jonathan H. Wage <jwage@mac.com>, Thomas Courbon <harthie@yahoo.fr> 
    3232 */ 
    3333class Doctrine_Parser_Yml extends Doctrine_Parser 
     
    3838     * Dump an array of data to a specified path or return 
    3939     *  
     40     * @throws Doctrine_Parser_Exception dumping error 
    4041     * @param  string $array Array of data to dump to yaml 
    4142     * @param  string $path  Path to dump the yaml to 
     
    4546    public function dumpData($array, $path = null) 
    4647    { 
    47         $spyc = new Doctrine_Parser_Spyc(); 
    48          
    49         $data = $spyc->dump($array, false, false); 
    50          
    51         return $this->doDump($data, $path); 
     48        
     49        try { 
     50          $data = Doctrine_Parser_sfYaml::dump($array); 
     51           
     52          return $this->doDump($data, $path); 
     53           
     54        } catch(InvalidArgumentException $e) { 
     55          // rethrow the exceptions 
     56          $rethrowed_exception = new Doctrine_Parser_Exception($e->getMessage(), $e->getCode()); 
     57           
     58          throw $rethrowed_exception; 
     59        } 
    5260    } 
    5361 
     
    5765     * Load and parse data from a yml file 
    5866     *  
     67     * @throws Doctrine_Parser_Exception parsing error 
    5968     * @param  string  $path  Path to load yaml data from 
    6069     * @return array   $array Array of parsed yaml data 
     
    6271    public function loadData($path) 
    6372    { 
    64         $contents = $this->doLoad($path); 
     73        try { 
     74          /* 
     75           * I still use the doLoad method even if sfYaml can load yml from a file 
     76           * since this way Doctrine can handle file on it own. 
     77           */  
     78          $contents = $this->doLoad($path); 
    6579 
    66         $spyc = new Doctrine_Parser_Spyc(); 
    67          
    68         $array = $spyc->load($contents); 
    69          
    70         return $array; 
    71     } 
     80          $array = Doctrine_Parser_sfYaml::load($contents); 
     81           
     82          return $array; 
     83           
     84        } catch(InvalidArgumentException $e) { 
     85          // rethrow the exceptions 
     86          $rethrowed_exception = new Doctrine_Parser_Exception($e->getMessage(), $e->getCode()); 
     87           
     88          throw $rethrowed_exception; 
     89        } 
     90    }         
    7291}