X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FMapping%2FLoader%2FXmlFileLoader.php;fp=vendor%2Fsymfony%2Fvalidator%2FMapping%2FLoader%2FXmlFileLoader.php;h=6548c5aecea485c53c71278c63f403ad23e6a692;hp=8bcdf9f97ef94d6c2af58469a9da99421f217f21;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php index 8bcdf9f97..6548c5aec 100644 --- a/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php +++ b/vendor/symfony/validator/Mapping/Loader/XmlFileLoader.php @@ -35,19 +35,7 @@ class XmlFileLoader extends FileLoader public function loadClassMetadata(ClassMetadata $metadata) { if (null === $this->classes) { - // This method may throw an exception. Do not modify the class' - // state before it completes - $xml = $this->parseFile($this->file); - - $this->classes = array(); - - foreach ($xml->namespace as $namespace) { - $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); - } - - foreach ($xml->class as $class) { - $this->classes[(string) $class['name']] = $class; - } + $this->loadClassesFromXml(); } if (isset($this->classes[$metadata->getClassName()])) { @@ -61,6 +49,20 @@ class XmlFileLoader extends FileLoader return false; } + /** + * Return the names of the classes mapped in this file. + * + * @return string[] The classes names + */ + public function getMappedClasses() + { + if (null === $this->classes) { + $this->loadClassesFromXml(); + } + + return array_keys($this->classes); + } + /** * Parses a collection of "constraint" XML nodes. * @@ -182,6 +184,23 @@ class XmlFileLoader extends FileLoader return simplexml_import_dom($dom); } + private function loadClassesFromXml() + { + // This method may throw an exception. Do not modify the class' + // state before it completes + $xml = $this->parseFile($this->file); + + $this->classes = array(); + + foreach ($xml->namespace as $namespace) { + $this->addNamespaceAlias((string) $namespace['prefix'], trim((string) $namespace)); + } + + foreach ($xml->class as $class) { + $this->classes[(string) $class['name']] = $class; + } + } + private function loadClassMetadataFromXml(ClassMetadata $metadata, \SimpleXMLElement $classDescription) { if (count($classDescription->{'group-sequence-provider'}) > 0) {