Changeset 4744
- Timestamp:
- 08/07/08 15:03:54 (11 months ago)
- Location:
- branches/1.0/lib/Doctrine/Parser
- Files:
-
- 5 added
- 1 modified
-
sfYaml (added)
-
sfYaml.php (added)
-
sfYaml/Dumper.php (added)
-
sfYaml/Inline.php (added)
-
sfYaml/Parser.php (added)
-
Yml.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/lib/Doctrine/Parser/Yml.php
r4114 r4744 29 29 * @since 1.0 30 30 * @version $Revision: 1080 $ 31 * @author Jonathan H. Wage <jwage@mac.com> 31 * @author Jonathan H. Wage <jwage@mac.com>, Thomas Courbon <harthie@yahoo.fr> 32 32 */ 33 33 class Doctrine_Parser_Yml extends Doctrine_Parser … … 38 38 * Dump an array of data to a specified path or return 39 39 * 40 * @throws Doctrine_Parser_Exception dumping error 40 41 * @param string $array Array of data to dump to yaml 41 42 * @param string $path Path to dump the yaml to … … 45 46 public function dumpData($array, $path = null) 46 47 { 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 } 52 60 } 53 61 … … 57 65 * Load and parse data from a yml file 58 66 * 67 * @throws Doctrine_Parser_Exception parsing error 59 68 * @param string $path Path to load yaml data from 60 69 * @return array $array Array of parsed yaml data … … 62 71 public function loadData($path) 63 72 { 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); 65 79 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 } 72 91 }