1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Moved Doctrine_Migration_Builder and Doctrine_Import_Builder to Doctrine_Builder_Migration and Doctrine_Builder_Record. Updated code to work with new class names.

This commit is contained in:
jwage 2008-01-23 16:47:58 +00:00
parent 04d945a194
commit 8cc89beb41
11 changed files with 131 additions and 102 deletions

View File

@ -974,7 +974,7 @@ final class Doctrine
*/
public static function generateMigrationClass($className, $migrationsPath)
{
$builder = new Doctrine_Migration_Builder($migrationsPath);
$builder = new Doctrine_Builder_Migration($migrationsPath);
return $builder->generateMigrationClass($className);
}
@ -988,7 +988,7 @@ final class Doctrine
*/
public static function generateMigrationsFromDb($migrationsPath)
{
$builder = new Doctrine_Migration_Builder($migrationsPath);
$builder = new Doctrine_Builder_Migration($migrationsPath);
return $builder->generateMigrationsFromDb();
}
@ -1002,7 +1002,7 @@ final class Doctrine
*/
public static function generateMigrationsFromModels($migrationsPath, $modelsPath = null)
{
$builder = new Doctrine_Migration_Builder($migrationsPath);
$builder = new Doctrine_Builder_Migration($migrationsPath);
return $builder->generateMigrationsFromModels($modelsPath);
}

View File

@ -1,6 +1,6 @@
<?php
/*
* $Id$
* $Id: Builder.php 3570 2008-01-22 22:52:53Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@ -18,27 +18,20 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Import_Builder');
/**
* @package Doctrine
* @url http://www.phpdoctrine.org
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
* @version $Id$
*/
/**
* class Doctrine_Import_Builder_BaseClass
* Builds a Doctrine_Record base class definition based on a schema.
* Doctrine_Builder
*
* @package Doctrine
* @subpackage Import
* @link www.phpdoctrine.com
* @subpackage Builder
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
* @version $Revision: 3570 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Import_Builder_BaseClass extends Doctrine_Import_Builder
abstract class Doctrine_Builder
{
}

View File

@ -1,6 +1,6 @@
<?php
/*
* $Id$
* $Id: Exception.php 3570 2008-01-22 22:52:53Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@ -18,25 +18,28 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Import_Exception');
Doctrine::autoload('Doctrine_Exception');
/**
* @package Doctrine
* @subpackage Import
* @url http://www.phpdoctrine.org
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
* @version $Id$
* @version $Id: Exception.php 3570 2008-01-22 22:52:53Z jwage $
*/
/**
* class Doctrine_Import_Builder_Exception
* Doctrine_Builder_Exception
*
* @package Doctrine
* @subpackage Import
* @subpackage Builder
* @link www.phpdoctrine.com
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0
* @version $Revision$
* @version $Revision: 3570 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Import_Builder_Exception extends Doctrine_Import_Exception
{ }
class Doctrine_Builder_Exception extends Doctrine_Exception
{
}

View File

@ -23,7 +23,7 @@
* Doctrine_Migration_Builder
*
* @package Doctrine
* @subpackage Migration
* @subpackage Builder
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
@ -31,7 +31,7 @@
* @since 1.0
* @version $Revision: 2939 $
*/
class Doctrine_Migration_Builder
class Doctrine_Builder_Migration extends Doctrine_Builder
{
/**
* migrationsPath

View File

@ -26,7 +26,7 @@
* based on a database schema.
*
* @package Doctrine
* @subpackage Import
* @subpackage Builder
* @link www.phpdoctrine.com
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 1.0
@ -36,7 +36,7 @@
* @author Nicolas Bérard-Nault <nicobn@php.net>
* @author Jonathan H. Wage <jwage@mac.com>
*/
class Doctrine_Import_Builder
class Doctrine_Builder_Record
{
/**
* Path
@ -625,7 +625,7 @@ END;
public function buildDefinition(array $definition)
{
if ( ! isset($definition['className'])) {
throw new Doctrine_Import_Builder_Exception('Missing class name.');
throw new Doctrine_Builder_Exception('Missing class name.');
}
$abstract = isset($definition['abstract']) && $definition['abstract'] === true ? 'abstract ':null;
@ -667,7 +667,7 @@ END;
public function buildRecord(array $definition)
{
if ( !isset($definition['className'])) {
throw new Doctrine_Import_Builder_Exception('Missing class name.');
throw new Doctrine_Builder_Exception('Missing class name.');
}
if ($this->generateBaseClasses()) {
@ -802,7 +802,7 @@ END;
}
if (isset($bytes) && $bytes === false) {
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $writePath);
throw new Doctrine_Builder_Exception("Couldn't write file " . $writePath);
}
}
}

View File

@ -207,7 +207,7 @@ class Doctrine_Import extends Doctrine_Connection_Module
continue;
}
$builder = new Doctrine_Import_Builder();
$builder = new Doctrine_Builder_Record();
$builder->setTargetPath($directory);
$builder->setOptions($options);

View File

@ -146,7 +146,7 @@ class Doctrine_Import_Schema
*/
public function importSchema($schema, $format = 'yml', $directory = null, $models = array())
{
$builder = new Doctrine_Import_Builder();
$builder = new Doctrine_Builder_Record();
$builder->setTargetPath($directory);
$builder->setOptions($this->getOptions());

View File

@ -22,15 +22,13 @@
/**
* Doctrine_Migration
*
* this class represents a database view
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jwage@mac.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Migration
{

View File

@ -0,0 +1,35 @@
<?php
/*
* $Id: Diff.php 1080 2007-02-10 18:17:08Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Migration_Diff
*
* @package Doctrine
* @subpackage Migration
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision: 1080 $
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class Doctrine_Migration_Diff
{
}

View File

@ -266,7 +266,7 @@ abstract class Doctrine_Record_Generator extends Doctrine_Record_Abstract
{
$options['className'] = $this->_options['className'];
$builder = new Doctrine_Import_Builder();
$builder = new Doctrine_Builder_Record();
if ($this->_options['generateFiles']) {
if (isset($this->_options['generatePath']) && $this->_options['generatePath']) {

View File

@ -36,7 +36,7 @@ class Doctrine_Import_Builder_TestCase extends Doctrine_UnitTestCase
{
$table = $this->conn->getTable('Phonenumber');
$builder = new Doctrine_Import_Builder();
$builder = new Doctrine_Builder_Record();
$rel = $builder->buildRelationDefinition($table->getRelations());