Permalink
Browse files

BUGFIX: Use the copy of symfony-yaml bundled with Zend_Translate to p…

…revent class conflicts. Remove now-unnecessary symonfy-yaml thirdparty lib.
  • Loading branch information...
1 parent cde9b31 commit cc7a01213948b2cdb3ba59cab37cc8a1516f06e6 @sminnee sminnee committed Apr 17, 2012
@@ -176,9 +176,8 @@ public function addYAMLConfigFile($basename, $pathname, $depth) {
// Keep track of all the modules we've seen
$this->addModule(dirname(dirname($pathname)));
- // We use Symfony Yaml since it's the most complete. It still doesn't handle all of YAML, but it's better than
- // nothing.
- if(!class_exists('sfYamlParser', false)) require_once 'thirdparty/symfony-yaml/lib/sfYamlParser.php';
+ // Use the Zend copy of this script to prevent class conflicts when RailsYaml is included
+ require_once 'thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYamlParser.php';
$parser = new sfYamlParser();
// The base header
@@ -495,8 +495,8 @@ public function write($entities, $locale, $path) {
}
public function getYaml($entities, $locale) {
- // Check required because Zend_Translate_RailsYAML also includes the lib, from a different location
- if(!class_exists('sfYamlDumper', false)) require_once 'thirdparty/symfony-yaml/lib/sfYamlDumper.php';
+ // Use the Zend copy of this script to prevent class conflicts when RailsYaml is included
+ require_once 'thirdparty/zend_translate_railsyaml/library/Translate/Adapter/thirdparty/sfYaml/lib/sfYamlDumper.php';
// Unflatten array
$entitiesNested = array();
@@ -1,8 +0,0 @@
----
-format: 1
-handler:
- commit: 8a266aadcec878681ed458796b1ce792cc377f79
- branch: master
-lock: false
-repository_class: Piston::Git::Repository
-repository_url: https://github.com/fabpot/yaml.git
@@ -1,19 +0,0 @@
-Copyright (c) 2008-2009 Fabien Potencier
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
@@ -1,15 +0,0 @@
-Symfony YAML: A PHP library that speaks YAML
-============================================
-
-Symfony YAML is a PHP library that parses YAML strings and converts them to
-PHP arrays. It can also converts PHP arrays to YAML strings. Its official
-website is at http://components.symfony-project.org/yaml/.
-
-The documentation is to be found in the `doc/` directory.
-
-Symfony YAML is licensed under the MIT license (see LICENSE file).
-
-The Symfony YAML library is developed and maintained by the
-[symfony](http://www.symfony-project.org/) project team. It has been extracted
-from symfony to be used as a standalone library. Symfony YAML is part of the
-[symfony components project](http://components.symfony-project.org/).
@@ -1,143 +0,0 @@
-Introduction
-============
-
-This book is about *Symfony YAML*, a PHP library part of the Symfony
-Components project. Its official website is at
-http://components.symfony-project.org/yaml/.
-
->**SIDEBAR**
->About the Symfony Components
->
->[Symfony Components](http://components.symfony-project.org/) are
->standalone PHP classes that can be easily used in any
->PHP project. Most of the time, they have been developed as part of the
->[Symfony framework](http://www.symfony-project.org/), and decoupled from the
->main framework later on. You don't need to use the Symfony MVC framework to use
->the components.
-
-What is it?
------------
-
-Symfony YAML is a PHP library that parses YAML strings and converts them to
-PHP arrays. It can also converts PHP arrays to YAML strings.
-
-[YAML](http://www.yaml.org/), YAML Ain't Markup Language, is a human friendly
-data serialization standard for all programming languages. YAML is a great
-format for your configuration files. YAML files are as expressive as XML files
-and as readable as INI files.
-
-### Easy to use
-
-There is only one archive to download, and you are ready to go. No
-configuration, No installation. Drop the files in a directory and start using
-it today in your projects.
-
-### Open-Source
-
-Released under the MIT license, you are free to do whatever you want, even in
-a commercial environment. You are also encouraged to contribute.
-
-
-### Used by popular Projects
-
-Symfony YAML was initially released as part of the symfony framework, one of
-the most popular PHP web framework. It is also embedded in other popular
-projects like PHPUnit or Doctrine.
-
-### Documented
-
-Symfony YAML is fully documented, with a dedicated online book, and of course
-a full API documentation.
-
-### Fast
-
-One of the goal of Symfony YAML is to find the right balance between speed and
-features. It supports just the needed feature to handle configuration files.
-
-### Unit tested
-
-The library is fully unit-tested. With more than 400 unit tests, the library
-is stable and is already used in large projects.
-
-### Real Parser
-
-It sports a real parser and is able to parse a large subset of the YAML
-specification, for all your configuration needs. It also means that the parser
-is pretty robust, easy to understand, and simple enough to extend.
-
-### Clear error messages
-
-Whenever you have a syntax problem with your YAML files, the library outputs a
-helpful message with the filename and the line number where the problem
-occurred. It eases the debugging a lot.
-
-### Dump support
-
-It is also able to dump PHP arrays to YAML with object support, and inline
-level configuration for pretty outputs.
-
-### Types Support
-
-It supports most of the YAML built-in types like dates, integers, octals,
-booleans, and much more...
-
-
-### Full merge key support
-
-Full support for references, aliases, and full merge key. Don't repeat
-yourself by referencing common configuration bits.
-
-### PHP Embedding
-
-YAML files are dynamic. By embedding PHP code inside a YAML file, you have
-even more power for your configuration files.
-
-Installation
-------------
-
-Symfony YAML can be installed by downloading the source code as a
-[tar](http://github.com/fabpot/yaml/tarball/master) archive or a
-[zip](http://github.com/fabpot/yaml/zipball/master) one.
-
-To stay up-to-date, you can also use the official Subversion
-[repository](http://svn.symfony-project.com/components/yaml/).
-
-If you are a Git user, there is an official
-[mirror](http://github.com/fabpot/yaml), which is updated every 10 minutes.
-
-If you prefer to install the component globally on your machine, you can use
-the symfony [PEAR](http://pear.symfony-project.com/) channel server.
-
-Support
--------
-
-Support questions and enhancements can be discussed on the
-[mailing-list](http://groups.google.com/group/symfony-components).
-
-If you find a bug, you can create a ticket at the symfony
-[trac](http://trac.symfony-project.org/newticket) under the *YAML* component.
-
-License
--------
-
-The Symfony YAML component is licensed under the *MIT license*:
-
->Copyright (c) 2008-2009 Fabien Potencier
->
->Permission is hereby granted, free of charge, to any person obtaining a copy
->of this software and associated documentation files (the "Software"), to deal
->in the Software without restriction, including without limitation the rights
->to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
->copies of the Software, and to permit persons to whom the Software is furnished
->to do so, subject to the following conditions:
->
->The above copyright notice and this permission notice shall be included in all
->copies or substantial portions of the Software.
->
->THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
->IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
->FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
->AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
->LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
->OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
->THE SOFTWARE.
@@ -1,110 +0,0 @@
-Using Symfony YAML
-==================
-
-The Symfony YAML library is very simple and consists of two main classes: one
-to parse YAML strings (`sfYamlParser`), and the other to dump a PHP array to
-a YAML string (`sfYamlDumper`).
-
-On top of these two core classes, the main `sfYaml` class acts as a thin
-wrapper and simplifies common uses.
-
-Reading YAML Files
-------------------
-
-The `sfYamlParser::parse()` method parses a YAML string and converts it to a
-PHP array:
-
- [php]
- $yaml = new sfYamlParser();
- $value = $yaml->parse(file_get_contents('/path/to/file.yaml'));
-
-If an error occurs during parsing, the parser throws an exception indicating
-the error type and the line in the original YAML string where the error
-occurred:
-
- [php]
- try
- {
- $value = $yaml->parse(file_get_contents('/path/to/file.yaml'));
- }
- catch (InvalidArgumentException $e)
- {
- // an error occurred during parsing
- echo "Unable to parse the YAML string: ".$e->getMessage();
- }
-
->**TIP**
->As the parser is reentrant, you can use the same parser object to load
->different YAML strings.
-
-When loading a YAML file, it is sometimes better to use the `sfYaml::load()`
-wrapper method:
-
- [php]
- $loader = sfYaml::load('/path/to/file.yml');
-
-The `sfYaml::load()` static method takes a YAML string or a file containing
-YAML. Internally, it calls the `sfYamlParser::parse()` method, but with some
-added bonuses:
-
- * It executes the YAML file as if it was a PHP file, so that you can embed
- PHP commands in YAML files;
-
- * When a file cannot be parsed, it automatically adds the file name to the
- error message, simplifying debugging when your application is loading
- several YAML files.
-
-Writing YAML Files
-------------------
-
-The `sfYamlDumper` dumps any PHP array to its YAML representation:
-
- [php]
- $array = array('foo' => 'bar', 'bar' => array('foo' => 'bar', 'bar' => 'baz'));
-
- $dumper = new sfYamlDumper();
- $yaml = $dumper->dump($array);
- file_put_contents('/path/to/file.yaml', $yaml);
-
->**NOTE**
->Of course, the Symfony YAML dumper is not able to dump resources. Also,
->even if the dumper is able to dump PHP objects, it is to be considered
->an alpha feature.
-
-If you only need to dump one array, you can use the `sfYaml::dump()` static
-method shortcut:
-
- [php]
- $yaml = sfYaml::dump($array, $inline);
-
-The YAML format supports two kind of representation for arrays, the expanded
-one, and the inline one. By default, the dumper uses the inline
-representation:
-
- [yml]
- { foo: bar, bar: { foo: bar, bar: baz } }
-
-The second argument of the `dump()` method customizes the level at which the
-output switches from the expanded representation to the inline one:
-
- [php]
- echo $dumper->dump($array, 1);
-
--
-
- [yml]
- foo: bar
- bar: { foo: bar, bar: baz }
-
--
-
- [php]
- echo $dumper->dump($array, 2);
-
--
-
- [yml]
- foo: bar
- bar:
- foo: bar
- bar: baz
Oops, something went wrong.

0 comments on commit cc7a012

Please sign in to comment.