From e06f7c981d711eb7bd8a211f03fd6e244097b443 Mon Sep 17 00:00:00 2001 From: jwage Date: Tue, 16 Mar 2010 23:03:29 +0000 Subject: [PATCH] [2.0] Updating Symfony Yaml component to PHP 5.3 version --- lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php | 9 +-------- .../ORM/Tools/Cli/Tasks/ConvertMappingTask.php | 9 +-------- lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php | 11 ++--------- lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php | 9 +-------- tests/Doctrine/Tests/TestInit.php | 6 ++++-- 5 files changed, 9 insertions(+), 35 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php index 36fceb7b7..bf04f93d1 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php @@ -24,13 +24,6 @@ namespace Doctrine\ORM\Mapping\Driver; use Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\ORM\Mapping\MappingException; -if ( ! class_exists('sfYaml', false)) { - require_once __DIR__ . '/../../../../vendor/sfYaml/sfYaml.class.php'; - require_once __DIR__ . '/../../../../vendor/sfYaml/sfYamlDumper.class.php'; - require_once __DIR__ . '/../../../../vendor/sfYaml/sfYamlInline.class.php'; - require_once __DIR__ . '/../../../../vendor/sfYaml/sfYamlParser.class.php'; -} - /** * The YamlDriver reads the mapping metadata from yaml schema files. * @@ -434,6 +427,6 @@ class YamlDriver extends AbstractFileDriver */ protected function _loadMappingFile($file) { - return \sfYaml::load($file); + return \Symfony\Components\Yaml\Yaml::load($file); } } \ No newline at end of file diff --git a/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php b/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php index 1f5aa8ffb..61d63cf8f 100644 --- a/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php +++ b/lib/Doctrine/ORM/Tools/Cli/Tasks/ConvertMappingTask.php @@ -180,17 +180,10 @@ class ConvertMappingTask extends AbstractTask private function _isDoctrine1Schema(array $from) { - if ( ! class_exists('sfYaml', false)) { - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYaml.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlDumper.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlInline.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlParser.class.php'; - } - $files = glob(current($from) . '/*.yml'); if ($files) { - $array = \sfYaml::load($files[0]); + $array = \Symfony\Components\Yaml\Yaml::load($files[0]); $first = current($array); // We're dealing with a Doctrine 1 schema if you have diff --git a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php index b95afd99e..1ec0416ef 100644 --- a/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php +++ b/lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php @@ -25,13 +25,6 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\ORM\Tools\Export\Driver\AbstractExporter, Doctrine\Common\Util\Inflector; -if ( ! class_exists('sfYaml', false)) { - require_once __DIR__ . '/../../../vendor/sfYaml/sfYaml.class.php'; - require_once __DIR__ . '/../../../vendor/sfYaml/sfYamlDumper.class.php'; - require_once __DIR__ . '/../../../vendor/sfYaml/sfYamlInline.class.php'; - require_once __DIR__ . '/../../../vendor/sfYaml/sfYamlParser.class.php'; -} - /** * Class to help with converting Doctrine 1 schema files to Doctrine 2 mapping files * @@ -76,10 +69,10 @@ class ConvertDoctrine1Schema if (is_dir($path)) { $files = glob($path . '/*.yml'); foreach ($files as $file) { - $schema = array_merge($schema, (array) \sfYaml::load($file)); + $schema = array_merge($schema, (array) \Symfony\Components\Yaml\Yaml::load($file)); } } else { - $schema = array_merge($schema, (array) \sfYaml::load($path)); + $schema = array_merge($schema, (array) \Symfony\Components\Yaml\Yaml::load($path)); } } diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index ac3fc7105..bc9cc108d 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -27,13 +27,6 @@ use Doctrine\ORM\Mapping\ClassMetadataInfo, Doctrine\ORM\Mapping\OneToManyMapping, Doctrine\ORM\Mapping\ManyToManyMapping; -if ( ! class_exists('sfYaml', false)) { - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYaml.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlDumper.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlInline.class.php'; - require_once __DIR__ . '/../../../../../vendor/sfYaml/sfYamlParser.class.php'; -} - /** * ClassMetadata exporter for Doctrine YAML mapping files * @@ -184,6 +177,6 @@ class YamlExporter extends AbstractExporter } } - return \sfYaml::dump(array($metadata->name => $array), 10); + return \Symfony\Components\Yaml\Yaml::dump(array($metadata->name => $array), 10); } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/TestInit.php b/tests/Doctrine/Tests/TestInit.php index 5be820739..0945ce50c 100644 --- a/tests/Doctrine/Tests/TestInit.php +++ b/tests/Doctrine/Tests/TestInit.php @@ -13,9 +13,11 @@ require_once __DIR__ . '/../../../lib/Doctrine/Common/ClassLoader.php'; $classLoader = new \Doctrine\Common\ClassLoader('Doctrine'); $classLoader->register(); +$classLoader = new \Doctrine\Common\ClassLoader('Symfony', __DIR__ . '/../../../lib/vendor'); +$classLoader->register(); + set_include_path( __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path() -); - +); \ No newline at end of file