Minor changes backported from 0.9 and 0.10
This commit is contained in:
parent
23ab5b902d
commit
bea3a7c50d
@ -385,6 +385,19 @@ abstract class Doctrine_Configurable extends Doctrine_Locator_Injectable
|
||||
*/
|
||||
public function getAttribute($attribute)
|
||||
{
|
||||
if (is_string($attribute)) {
|
||||
$upper = strtoupper($attribute);
|
||||
|
||||
$const = 'Doctrine::ATTR_' . $upper;
|
||||
|
||||
if (defined($const)) {
|
||||
$attribute = constant($const);
|
||||
$this->_state = $attribute;
|
||||
} else {
|
||||
throw new Doctrine_Exception('Unknown attribute: "' . $attribute . '"');
|
||||
}
|
||||
}
|
||||
|
||||
$attribute = (int) $attribute;
|
||||
|
||||
if ($attribute < 0) {
|
||||
|
@ -328,11 +328,26 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* setName
|
||||
*
|
||||
* Sets the name of the connection
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* getDriverName
|
||||
*
|
||||
* Gets the name of the instance driver
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getDriverName()
|
||||
{
|
||||
return $this->driverName;
|
||||
|
@ -130,6 +130,9 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
foreach ($row as $key => $value) {
|
||||
if ($obj->getTable()->hasField($key)) {
|
||||
$obj->set($key, $value);
|
||||
} else if (method_exists($obj, 'set' . Doctrine::classify($key))) {
|
||||
$func = 'set' . Doctrine::classify($key);
|
||||
$obj->$func($value);
|
||||
} else if ($obj->getTable()->hasRelation($key)) {
|
||||
if (is_array($value)) {
|
||||
if (isset($value[0])) {
|
||||
@ -149,9 +152,6 @@ class Doctrine_Data_Import extends Doctrine_Data
|
||||
} else {
|
||||
$obj->set($key, $this->_getImportedObject($value));
|
||||
}
|
||||
} else if (method_exists($obj, 'set' . Doctrine::classify($key))) {
|
||||
$func = 'set' . Doctrine::classify($key);
|
||||
$obj->$func($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
136
package.php
136
package.php
@ -1,21 +1,23 @@
|
||||
<?php
|
||||
|
||||
require_once('PEAR/PackageFileManager2.php');
|
||||
PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
||||
buildPearPackage('/Users/jwage/Sites/doctrine/trunk', '0.9.0', 'beta');
|
||||
|
||||
$packagexml = new PEAR_PackageFileManager2;
|
||||
function buildPearPackage($path, $version, $state)
|
||||
{
|
||||
$packageFile = $path . DIRECTORY_SEPARATOR . 'package.xml';
|
||||
|
||||
require_once('PEAR/packageFileManager2.php');
|
||||
PEAR::setErrorHandling(PEAR_ERROR_DIE);
|
||||
|
||||
$version_release = '0.9';
|
||||
$version_api = $version_release;
|
||||
$state = 'beta';
|
||||
|
||||
$notes = <<<EOT
|
||||
barfoo
|
||||
$packagexml = new PEAR_packageFileManager2;
|
||||
|
||||
$notes = <<<EOT
|
||||
-
|
||||
EOT;
|
||||
|
||||
$summary = 'PHP5 Database ORM';
|
||||
$summary = 'PHP5 Database ORM';
|
||||
|
||||
$description =<<<EOT
|
||||
$description =<<<EOT
|
||||
Doctrine is an ORM (object relational mapper) for PHP 5.2.x+ that sits on top of
|
||||
a powerful DBAL (database abstraction layer). One of its key features is the
|
||||
ability to optionally write database queries in an OO (object oriented)
|
||||
@ -24,57 +26,69 @@ a powerful alternative to SQL that maintains a maximum of flexibility without
|
||||
requiring needless code duplication.
|
||||
EOT;
|
||||
|
||||
$packagefile = './package.xml';
|
||||
$options = array(
|
||||
'filelistgenerator' => 'svn',
|
||||
'changelogoldtonew' => false,
|
||||
'simpleoutput' => true,
|
||||
'baseinstalldir' => '/',
|
||||
'packagedirectory' => $path,
|
||||
'packageFile' => $packageFile,
|
||||
'clearcontents' => false,
|
||||
// What to ignore
|
||||
'ignore' => array(
|
||||
$path . DIRECTORY_SEPARATOR . 'vendor/',
|
||||
$path . DIRECTORY_SEPARATOR . 'package*.*',
|
||||
$path . DIRECTORY_SEPARATOR . 'tests_old/',
|
||||
$path . DIRECTORY_SEPARATOR . 'tests/',
|
||||
$path . DIRECTORY_SEPARATOR . 'tools/'
|
||||
),
|
||||
// What to include in package
|
||||
'include' => array(
|
||||
$path . DIRECTORY_SEPARATOR . 'lib/',
|
||||
$path . DIRECTORY_SEPARATOR . 'manual/',
|
||||
$path . DIRECTORY_SEPARATOR . 'vendor/',
|
||||
$path . DIRECTORY_SEPARATOR . 'README',
|
||||
$path . DIRECTORY_SEPARATOR . 'CHANGELOG',
|
||||
$path . DIRECTORY_SEPARATOR . 'LICENSE',
|
||||
$path . DIRECTORY_SEPARATOR . 'COPYRIGHT'
|
||||
),
|
||||
// Dir roles
|
||||
'dir_roles' => array(
|
||||
'lib' => 'php',
|
||||
'manual' => 'doc',
|
||||
'vendor' => 'php'
|
||||
),
|
||||
// File roles
|
||||
'exceptions' => array(
|
||||
'README' => 'doc',
|
||||
'CHANGELOG' => 'doc',
|
||||
'LICENSE' => 'doc',
|
||||
'COPYRIGHT' => 'doc'
|
||||
)
|
||||
);
|
||||
|
||||
$options = array(
|
||||
'filelistgenerator' => 'svn',
|
||||
'changelogoldtonew' => false,
|
||||
'simpleoutput' => true,
|
||||
'baseinstalldir' => '/',
|
||||
'packagedirectory' => './',
|
||||
'packagefile' => $packagefile,
|
||||
'clearcontents' => false,
|
||||
'ignore' => array(
|
||||
'vendor/',
|
||||
'tools/',
|
||||
'package*.php',
|
||||
'package*.xml',
|
||||
),
|
||||
'dir_roles' => array(
|
||||
'lib' => 'php',
|
||||
'manual' => 'doc',
|
||||
'models' => 'doc',
|
||||
'tests' => 'test',
|
||||
),
|
||||
'exceptions' => array(
|
||||
'README' => 'doc',
|
||||
'CHANGELOG' => 'doc',
|
||||
'LICENSE' => 'doc',
|
||||
'COPYRIGHT' => 'doc'
|
||||
)
|
||||
);
|
||||
$package = &PEAR_packageFileManager2::importOptions($packageFile, $options);
|
||||
$package->setPackageType('php');
|
||||
|
||||
$package = &PEAR_PackageFileManager2::importOptions($packagefile, $options);
|
||||
$package->setPackageType('php');
|
||||
$package->clearDeps();
|
||||
$package->setPhpDep('5.2.3');
|
||||
$package->setPearInstallerDep('1.4.0b1');
|
||||
$package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6');
|
||||
|
||||
$package->clearDeps();
|
||||
$package->setPhpDep('5.2.3');
|
||||
$package->setPearInstallerDep('1.4.0b1');
|
||||
$package->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.3.6');
|
||||
$package->addRelease();
|
||||
$package->generateContents();
|
||||
$package->setReleaseVersion($version);
|
||||
$package->setAPIVersion($version);
|
||||
$package->setReleaseStability($state);
|
||||
$package->setAPIStability($state);
|
||||
$package->setNotes($notes);
|
||||
$package->setSummary($summary);
|
||||
$package->setDescription($description);
|
||||
$package->addGlobalReplacement('package-info', '@package_version@', 'version');
|
||||
|
||||
$package->addRelease();
|
||||
$package->generateContents();
|
||||
$package->setReleaseVersion($version_release);
|
||||
$package->setAPIVersion($version_api);
|
||||
$package->setReleaseStability($state);
|
||||
$package->setAPIStability($state);
|
||||
$package->setNotes($notes);
|
||||
$package->setSummary($summary);
|
||||
$package->setDescription($description);
|
||||
$package->addGlobalReplacement('package-info', '@package_version@', 'version');
|
||||
|
||||
if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
|
||||
$package->writePackageFile();
|
||||
} else {
|
||||
$package->debugPackageFile();
|
||||
}
|
||||
if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
|
||||
$package->writepackageFile();
|
||||
} else {
|
||||
$package->debugpackageFile();
|
||||
}
|
||||
}
|
@ -50,4 +50,4 @@ spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
|
||||
Doctrine_Manager::connection(DSN, 'sandbox');
|
||||
|
||||
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
|
||||
Doctrine_Manager::getInstance()->setAttribute('model_loading', 'conservative');
|
@ -1,5 +1,24 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
require_once('config.php');
|
||||
chdir(dirname(__FILE__));
|
||||
|
||||
define('SANDBOX_PATH', dirname(__FILE__));
|
||||
define('DOCTRINE_PATH', dirname(dirname(SANDBOX_PATH)) . DIRECTORY_SEPARATOR . 'lib');
|
||||
define('DATA_FIXTURES_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'fixtures');
|
||||
define('MODELS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'models');
|
||||
define('MIGRATIONS_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'migrations');
|
||||
define('SQL_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'sql');
|
||||
define('YAML_SCHEMA_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'schema');
|
||||
define('DB_PATH', SANDBOX_PATH . DIRECTORY_SEPARATOR . 'sandbox.db');
|
||||
define('DSN', 'sqlite:///' . DB_PATH);
|
||||
|
||||
require_once(DOCTRINE_PATH . DIRECTORY_SEPARATOR . 'Doctrine.php');
|
||||
|
||||
spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
|
||||
Doctrine_Manager::connection(DSN, 'sandbox');
|
||||
|
||||
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
|
||||
|
||||
// Configure Doctrine Cli
|
||||
// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled
|
||||
|
Loading…
Reference in New Issue
Block a user