Merge pull request #570 from Ocramius/cleanup/submodules-removal
Deprecation of PEAR/GIT/TAR autoloading
This commit is contained in:
commit
35fda90473
18
.gitmodules
vendored
18
.gitmodules
vendored
@ -1,18 +0,0 @@
|
||||
[submodule "lib/vendor/doctrine-common"]
|
||||
path = lib/vendor/doctrine-common
|
||||
url = git://github.com/doctrine/common.git
|
||||
[submodule "lib/vendor/doctrine-dbal"]
|
||||
path = lib/vendor/doctrine-dbal
|
||||
url = git://github.com/doctrine/dbal.git
|
||||
[submodule "lib/vendor/Symfony/Component/Console"]
|
||||
path = lib/vendor/Symfony/Component/Console
|
||||
url = git://github.com/symfony/Console.git
|
||||
[submodule "lib/vendor/Symfony/Component/Yaml"]
|
||||
path = lib/vendor/Symfony/Component/Yaml
|
||||
url = git://github.com/symfony/Yaml.git
|
||||
[submodule "lib/vendor/doctrine-build-common"]
|
||||
path = lib/vendor/doctrine-build-common
|
||||
url = git://github.com/doctrine/doctrine-build-common.git
|
||||
[submodule "docs/en/_theme"]
|
||||
path = docs/en/_theme
|
||||
url = git://github.com/doctrine/doctrine-sphinx-theme.git
|
@ -19,6 +19,6 @@ before_script:
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests;' -U postgres; fi"
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database doctrine_tests_tmp;' -U postgres; fi"
|
||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
|
||||
- git submodule update --init
|
||||
- composer install --prefer-source
|
||||
|
||||
script: phpunit --configuration tests/travis/$DB.travis.xml
|
@ -1,5 +1,10 @@
|
||||
# Upgrade to 2.4
|
||||
|
||||
## Composer is now the default autoloader
|
||||
|
||||
The test suite now runs with composer autoloading. Support for PEAR, and tarball autoloading is deprecated.
|
||||
Support for GIT submodules is removed.
|
||||
|
||||
## OnFlush and PostFlush event always called
|
||||
|
||||
Before 2.4 the postFlush and onFlush events were only called when there were
|
||||
|
@ -11,6 +11,7 @@
|
||||
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
|
||||
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"ext-pdo": "*",
|
||||
|
@ -55,6 +55,14 @@ different types of Doctrine Installations:
|
||||
|
||||
PEAR
|
||||
^^^^
|
||||
.. caution::
|
||||
|
||||
PEAR autoloading is deprecated as of version ``2.4`` of the ORM
|
||||
|
||||
.. note::
|
||||
|
||||
This assumes you've created some kind of script to test
|
||||
the following code in. Something like a ``test.php`` file.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -68,6 +76,10 @@ PEAR
|
||||
Tarball Download
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. caution::
|
||||
|
||||
Tarball autoloading is deprecated as of version ``2.4`` of the ORM
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
@ -77,22 +89,6 @@ Tarball Download
|
||||
$lib = "/path/to/doctrine2-orm/lib";
|
||||
Doctrine\ORM\Tools\Setup::registerAutoloadDirectory($lib);
|
||||
|
||||
Git
|
||||
^^^
|
||||
|
||||
The Git bootstrap assumes that you have fetched the related
|
||||
packages through ``git submodule update --init``
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
// test.php
|
||||
require 'Doctrine/ORM/Tools/Setup.php';
|
||||
|
||||
$lib = '/path/to/doctrine2-orm-root';
|
||||
Doctrine\ORM\Tools\Setup::registerAutoloadGit($lib);
|
||||
|
||||
|
||||
Additional Symfony Components
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -23,6 +23,10 @@ Then run the composer command and you are done. Continue with the
|
||||
PEAR
|
||||
----
|
||||
|
||||
.. caution::
|
||||
|
||||
PEAR autoloading is deprecated as of version ``2.4`` of the ORM
|
||||
|
||||
You can easily install any of the three Doctrine packages from the
|
||||
PEAR command line installation utility.
|
||||
|
||||
@ -58,36 +62,3 @@ it with the following command.
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo pear install pear.doctrine-project.org/DoctrineORM-2.2.2
|
||||
|
||||
GitHub
|
||||
------
|
||||
|
||||
Alternatively you can clone the latest version of Doctrine 2 via
|
||||
GitHub.com:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$ git clone git://github.com/doctrine/doctrine2.git doctrine
|
||||
|
||||
This downloads all the sources of the ORM package. You need to
|
||||
initialize the Github submodules for the Common and DBAL package
|
||||
dependencies:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$ git submodule init
|
||||
$ git submodule update
|
||||
|
||||
This updates your Git checkout to use the Doctrine and Doctrine
|
||||
package versions that are recommended for the cloned Master version
|
||||
of Doctrine 2.
|
||||
|
||||
See the configuration chapter on how to configure a Github
|
||||
installation of Doctrine with regards to autoloading.
|
||||
|
||||
.. note::
|
||||
|
||||
You should not combine the Doctrine-Common, Doctrine-DBAL and
|
||||
Doctrine-ORM master commits with each other in combination. The ORM
|
||||
may not work with the current Common or DBAL master versions.
|
||||
Instead the ORM ships with the Git Submodules that are required.
|
||||
|
@ -33,33 +33,6 @@ use Doctrine\ORM\Mapping\Driver\YamlDriver;
|
||||
*/
|
||||
class Setup
|
||||
{
|
||||
/**
|
||||
* Use this method to register all autoloaders for a setup where Doctrine is checked out from
|
||||
* its github repository at {@link http://github.com/doctrine/doctrine2}
|
||||
*
|
||||
* @param string $gitCheckoutRootPath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function registerAutoloadGit($gitCheckoutRootPath)
|
||||
{
|
||||
if (!class_exists('Doctrine\Common\ClassLoader', false)) {
|
||||
require_once $gitCheckoutRootPath . "/lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php";
|
||||
}
|
||||
|
||||
$loader = new ClassLoader("Doctrine\Common", $gitCheckoutRootPath . "/lib/vendor/doctrine-common/lib");
|
||||
$loader->register();
|
||||
|
||||
$loader = new ClassLoader("Doctrine\DBAL", $gitCheckoutRootPath . "/lib/vendor/doctrine-dbal/lib");
|
||||
$loader->register();
|
||||
|
||||
$loader = new ClassLoader("Doctrine\ORM", $gitCheckoutRootPath . "/lib");
|
||||
$loader->register();
|
||||
|
||||
$loader = new ClassLoader("Symfony\Component", $gitCheckoutRootPath . "/lib/vendor");
|
||||
$loader->register();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to register all autoloaders for a setup where Doctrine is installed
|
||||
* though {@link http://pear.doctrine-project.org}.
|
||||
|
@ -29,12 +29,12 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$tool = new SchemaTool($this->_em);
|
||||
$sql = $tool->getCreateSchemaSql($classes);
|
||||
|
||||
$this->assertEquals("CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[1]);
|
||||
$this->assertEquals("CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[2]);
|
||||
$this->assertEquals("CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[3]);
|
||||
$this->assertEquals("CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[4]);
|
||||
$this->assertEquals("CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[5]);
|
||||
$this->assertEquals("CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[1]);
|
||||
$this->assertEquals("CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[2]);
|
||||
$this->assertEquals("CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[3]);
|
||||
$this->assertEquals("CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[4]);
|
||||
$this->assertEquals("CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[5]);
|
||||
$this->assertEquals("ALTER TABLE cms_users ADD CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id)", $sql[6]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[7]);
|
||||
$this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id)", $sql[8]);
|
||||
@ -54,7 +54,7 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$sql = $tool->getCreateSchemaSql($classes);
|
||||
|
||||
$this->assertEquals(1, count($sql));
|
||||
$this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
|
||||
}
|
||||
|
||||
public function testGetCreateSchemaSql3()
|
||||
@ -67,7 +67,7 @@ class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$sql = $tool->getCreateSchemaSql($classes);
|
||||
|
||||
$this->assertEquals(1, count($sql));
|
||||
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,8 +19,8 @@ class DDC2182Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2182OptionChild'),
|
||||
));
|
||||
|
||||
$this->assertEquals("CREATE TABLE DDC2182OptionParent (id INT UNSIGNED NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE DDC2182OptionChild (id VARCHAR(255) NOT NULL, parent_id INT UNSIGNED DEFAULT NULL, INDEX IDX_B314D4AD727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDB", $sql[1]);
|
||||
$this->assertEquals("CREATE TABLE DDC2182OptionParent (id INT UNSIGNED NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[0]);
|
||||
$this->assertEquals("CREATE TABLE DDC2182OptionChild (id VARCHAR(255) NOT NULL, parent_id INT UNSIGNED DEFAULT NULL, INDEX IDX_B314D4AD727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB", $sql[1]);
|
||||
$this->assertEquals("ALTER TABLE DDC2182OptionChild ADD CONSTRAINT FK_B314D4AD727ACA70 FOREIGN KEY (parent_id) REFERENCES DDC2182OptionParent (id)", $sql[2]);
|
||||
}
|
||||
}
|
||||
|
@ -37,20 +37,13 @@ class SetupTest extends \Doctrine\Tests\OrmTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testGitAutoload()
|
||||
{
|
||||
Setup::registerAutoloadGit(__DIR__ . "/../../../../../");
|
||||
|
||||
$this->assertEquals($this->originalAutoloaderCount + 4, count(spl_autoload_functions()));
|
||||
}
|
||||
|
||||
public function testPEARAutoload()
|
||||
{
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . "/../../../../../lib/vendor/doctrine-common/lib");
|
||||
|
||||
Setup::registerAutoloadPEAR();
|
||||
|
||||
$this->assertEquals($this->originalAutoloaderCount + 2, count(spl_autoload_functions()));
|
||||
$this->assertEquals($this->originalAutoloaderCount + 1, count(spl_autoload_functions()));
|
||||
}
|
||||
|
||||
public function testDirectoryAutoload()
|
||||
|
@ -6,39 +6,24 @@ namespace Doctrine\Tests;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
|
||||
if (isset($GLOBALS['DOCTRINE_COMMON_PATH'])) {
|
||||
require_once $GLOBALS['DOCTRINE_COMMON_PATH'] . '/Doctrine/Common/ClassLoader.php';
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', $GLOBALS['DOCTRINE_COMMON_PATH']);
|
||||
if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
|
||||
// dependencies were installed via composer - this is the main project
|
||||
$classLoader = require __DIR__ . '/../../../vendor/autoload.php';
|
||||
} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
|
||||
// installed as a dependency in `vendor`
|
||||
$classLoader = require __DIR__ . '/../../../../../autoload.php';
|
||||
} else {
|
||||
require_once __DIR__ . '/../../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', __DIR__ . '/../../../lib/vendor/doctrine-common/lib');
|
||||
throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?');
|
||||
}
|
||||
$classLoader->register();
|
||||
|
||||
if (isset($GLOBALS['DOCTRINE_DBAL_PATH'])) {
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', $GLOBALS['DOCTRINE_DBAL_PATH']);
|
||||
} else {
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', __DIR__ . '/../../../lib/vendor/doctrine-dbal/lib');
|
||||
/* @var $classLoader \Composer\Autoload\ClassLoader */
|
||||
$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
|
||||
unset($classLoader);
|
||||
|
||||
if ( ! file_exists(__DIR__ . '/Proxies') && ! mkdir(__DIR__ . '/Proxies')) {
|
||||
throw new \Exception("Could not create " . __DIR__."/Proxies Folder.");
|
||||
}
|
||||
$classLoader->register();
|
||||
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', __DIR__ . '/../../../lib');
|
||||
$classLoader->register();
|
||||
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Tests', __DIR__ . '/../../');
|
||||
$classLoader->register();
|
||||
|
||||
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', __DIR__ . "/../../../lib/vendor");
|
||||
$classLoader->register();
|
||||
|
||||
if (!file_exists(__DIR__."/Proxies")) {
|
||||
if (!mkdir(__DIR__."/Proxies")) {
|
||||
throw new Exception("Could not create " . __DIR__."/Proxies Folder.");
|
||||
}
|
||||
}
|
||||
if (!file_exists(__DIR__."/ORM/Proxy/generated")) {
|
||||
if (!mkdir(__DIR__."/ORM/Proxy/generated")) {
|
||||
throw new Exception("Could not create " . __DIR__."/ORM/Proxy/generated Folder.");
|
||||
}
|
||||
if ( ! file_exists(__DIR__ . '/ORM/Proxy/generated') && ! mkdir(__DIR__ . '/ORM/Proxy/generated')) {
|
||||
throw new \Exception('Could not create ' . __DIR__ . '/ORM/Proxy/generated Folder.');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user