. */ /** * class Doctrine_Import_Schema * * Different methods to import a XML schema. The logic behind using two different * methods is simple. Some people will like the idea of producing Doctrine_Record * objects directly, which is totally fine. But in fast and growing application, * table definitions tend to be a little bit more volatile. importArr() can be used * to output a table definition in a PHP file. This file can then be stored * independantly from the object itself. * * @package Doctrine * @category Object Relational Mapping * @link www.phpdoctrine.com * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Revision: 1838 $ * @author Nicolas BĂ©rard-Nault * @author Jonathan H. Wage */ class Doctrine_Import_Schema { /** * import * * A method to import a Schema and translate it into a Doctrine_Record object * * @param string $schema The file containing the XML schema * @param string $directory The directory where the Doctrine_Record classes will * be written */ public function import($schema, $directory) { $builder = new Doctrine_Import_Builder(); $builder->setTargetPath($directory); $arr = $this->importSchema($schema); foreach ($arr as $name => $columns) { $options['className'] = $name; $options['fileName'] = $directory.DIRECTORY_SEPARATOR.$name.'.class.php'; $builder->buildRecord($options, $columns, array()); } } }