Remove mentions of PEAR installation method, remove code.
This commit is contained in:
parent
6b928600ba
commit
805bb5ff9f
@ -53,33 +53,9 @@ different types of Doctrine Installations:
|
|||||||
This assumes you've created some kind of script to test
|
This assumes you've created some kind of script to test
|
||||||
the following code in. Something like a ``test.php`` file.
|
the following code in. Something like a ``test.php`` file.
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// test.php
|
|
||||||
|
|
||||||
require 'Doctrine/ORM/Tools/Setup.php';
|
|
||||||
|
|
||||||
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR();
|
|
||||||
|
|
||||||
Tarball Download
|
Tarball Download
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. caution::
|
|
||||||
|
|
||||||
Tarball autoloading is deprecated as of version ``2.4`` of the ORM
|
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -568,10 +544,7 @@ script and the ``Doctrine\ORM\Tools\Console\ConsoleRunner`` command
|
|||||||
for inspiration how to setup the cli.
|
for inspiration how to setup the cli.
|
||||||
|
|
||||||
If you installed Doctrine 2 through Composer, then the Doctrine command is
|
If you installed Doctrine 2 through Composer, then the Doctrine command is
|
||||||
available to you in the bin-dir, by default at ``vendor/.bin/doctrine``.
|
available to you in the bin-dir, by default at ``vendor/bin/doctrine-orm``.
|
||||||
|
|
||||||
If you installed Doctrine 2 through PEAR, the ``doctrine`` command
|
|
||||||
line tool should already be available to you.
|
|
||||||
|
|
||||||
In general the required code looks like this:
|
In general the required code looks like this:
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
Doctrine can be installed many different ways. We will describe all the different ways and you can choose which one suits you best.
|
Doctrine was installable in many different ways, however `Composer <http://www.getcomposer.org>`_ turned out to be one of the best things for PHP in a long time.
|
||||||
|
This is why we moved all installation to use Composer only.
|
||||||
|
|
||||||
Composer
|
|
||||||
--------
|
|
||||||
|
|
||||||
`Composer <http://www.getcomposer.org>`_ is the suggested installation method for Doctrine.
|
|
||||||
Define the following requirement in your ``composer.json`` file:
|
Define the following requirement in your ``composer.json`` file:
|
||||||
|
|
||||||
::
|
::
|
||||||
@ -19,46 +16,3 @@ Define the following requirement in your ``composer.json`` file:
|
|||||||
|
|
||||||
Then run the composer command and you are done. Continue with the
|
Then run the composer command and you are done. Continue with the
|
||||||
:doc:`Configuration <configuration>`.
|
:doc:`Configuration <configuration>`.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To install just the ``Common`` package you can run the following
|
|
||||||
command:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ sudo pear install pear.doctrine-project.org/DoctrineCommon-<version>
|
|
||||||
|
|
||||||
If you want to use the Doctrine Database Abstraction Layer you can
|
|
||||||
install it with the following command.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ sudo pear install pear.doctrine-project.org/DoctrineDBAL-<version>
|
|
||||||
|
|
||||||
Or, if you want to get the works and go for the ORM you can install
|
|
||||||
it with the following command.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ sudo pear install pear.doctrine-project.org/DoctrineORM-<version>
|
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
The ``<version>`` tag above represents the version you
|
|
||||||
want to install. For example if the current version at the time of
|
|
||||||
writing this is ``2.2.2`` for the ORM, so you could install it
|
|
||||||
like the following:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ sudo pear install pear.doctrine-project.org/DoctrineORM-2.2.2
|
|
||||||
|
@ -14,20 +14,20 @@ information how to setup the console command.
|
|||||||
Getting Help
|
Getting Help
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
Type ``doctrine`` on the command line and you should see an
|
Type ``php vendor/bin/doctrine-orm`` on the command line and you should see an
|
||||||
overview of the available commands or use the --help flag to get
|
overview of the available commands or use the --help flag to get
|
||||||
information on the available commands. If you want to know more
|
information on the available commands. If you want to know more
|
||||||
about the use of generate entities for example, you can call:
|
about the use of generate entities for example, you can call:
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
doctrine orm:generate-entities --help
|
$> php vendor/bin/doctrine-orm orm:generate-entities --help
|
||||||
|
|
||||||
|
|
||||||
Configuration (PEAR)
|
Configuration
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Whenever the ``doctrine`` command line tool is invoked, it can
|
Whenever the ``doctrine-orm`` command line tool is invoked, it can
|
||||||
access all Commands that were registered by developer. There is no
|
access all Commands that were registered by developer. There is no
|
||||||
auto-detection mechanism at work. The Doctrine binary
|
auto-detection mechanism at work. The Doctrine binary
|
||||||
already registers all the commands that currently ship with
|
already registers all the commands that currently ship with
|
||||||
@ -91,36 +91,6 @@ namespace and use this.
|
|||||||
and use their facilities to access the Doctrine EntityManager and
|
and use their facilities to access the Doctrine EntityManager and
|
||||||
Connection Resources.
|
Connection Resources.
|
||||||
|
|
||||||
Configuration (Non-PEAR)
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
If you do not use a PEAR installation of Doctrine you have to define your own
|
|
||||||
Doctrine binary. Put this file into the application root and invoke it from
|
|
||||||
there whenever you want to access the Doctrine console.
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// doctrine.php - Put in your application root
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
|
|
||||||
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
|
||||||
use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
|
||||||
use Symfony\Component\Console\Helper\HelperSet;
|
|
||||||
|
|
||||||
require_once 'my_bootstrap.php';
|
|
||||||
|
|
||||||
// Any way to access the EntityManager from your application
|
|
||||||
$em = GetMyEntityManager();
|
|
||||||
|
|
||||||
$helperSet = new HelperSet(array(
|
|
||||||
'db' => new ConnectionHelper($em->getConnection()),
|
|
||||||
'em' => new EntityManagerHelper($em)
|
|
||||||
));
|
|
||||||
|
|
||||||
ConsoleRunner::run($helperSet);
|
|
||||||
|
|
||||||
|
|
||||||
Command Overview
|
Command Overview
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -484,7 +454,7 @@ Adding own commands
|
|||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
You can also add your own commands on-top of the Doctrine supported
|
You can also add your own commands on-top of the Doctrine supported
|
||||||
tools if you are using a manually built (Non-PEAR) binary.
|
tools if you are using a manually built console script.
|
||||||
|
|
||||||
To include a new command on Doctrine Console, you need to do modify the
|
To include a new command on Doctrine Console, you need to do modify the
|
||||||
``doctrine.php`` file a little:
|
``doctrine.php`` file a little:
|
||||||
|
@ -774,10 +774,7 @@ step:
|
|||||||
// bootstrap_doctrine.php
|
// bootstrap_doctrine.php
|
||||||
|
|
||||||
// See :doc:`Configuration <../reference/configuration>` for up to date autoloading details.
|
// See :doc:`Configuration <../reference/configuration>` for up to date autoloading details.
|
||||||
use Doctrine\ORM\Tools\Setup;
|
require_once "vendor/autoload.php";
|
||||||
|
|
||||||
require_once "Doctrine/ORM/Tools/Setup.php";
|
|
||||||
Setup::registerAutoloadPEAR();
|
|
||||||
|
|
||||||
// Create a simple "default" Doctrine ORM configuration for XML Mapping
|
// Create a simple "default" Doctrine ORM configuration for XML Mapping
|
||||||
$isDevMode = true;
|
$isDevMode = true;
|
||||||
@ -795,8 +792,8 @@ step:
|
|||||||
// obtaining the entity manager
|
// obtaining the entity manager
|
||||||
$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
|
$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
|
||||||
|
|
||||||
The first block sets up the autoloading capabilities of Doctrine.
|
The first require statement sets up the autoloading capabilities of Doctrine.
|
||||||
We assume here that you have installed Doctrine using PEAR.
|
We assume here that you have installed Doctrine using Composer.
|
||||||
See :doc:`Configuration <../reference/configuration>` for more details
|
See :doc:`Configuration <../reference/configuration>` for more details
|
||||||
on other installation procedures.
|
on other installation procedures.
|
||||||
|
|
||||||
@ -869,12 +866,12 @@ Doctrine command-line tool:
|
|||||||
::
|
::
|
||||||
|
|
||||||
$ cd project/
|
$ cd project/
|
||||||
$ doctrine orm:schema-tool:create
|
$ php vendor/bin/doctrine-orm orm:schema-tool:create
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The ``doctrine`` command will only be present if you installed
|
The ``doctrine`` command will only be present if you installed
|
||||||
Doctrine from PEAR. Otherwise you will have to dig into the
|
Doctrine from Composer. Otherwise you will have to dig into the
|
||||||
``bin/doctrine.php`` code of your Doctrine 2 directory to setup
|
``bin/doctrine.php`` code of your Doctrine 2 directory to setup
|
||||||
your doctrine command-line client.
|
your doctrine command-line client.
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ Doctrine explained in 10 quick steps
|
|||||||
====================================
|
====================================
|
||||||
|
|
||||||
You can follow this tutorial step by step yourself and end up with a simple
|
You can follow this tutorial step by step yourself and end up with a simple
|
||||||
Doctrine application. It assumed that you installed Doctrine via PEAR. To work
|
Doctrine application. It assumed that you installed Doctrine via Composer.
|
||||||
with another setup just take a look into the :doc:`Installation help
|
For more information take a look at the :doc:`Installation help
|
||||||
<../reference/introduction>`.
|
<../reference/introduction>`.
|
||||||
|
|
||||||
1. Allows you to map PHP Objects to database tables
|
1. Allows you to map PHP Objects to database tables
|
||||||
@ -209,14 +209,10 @@ with another setup just take a look into the :doc:`Installation help
|
|||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Doctrine\ORM\Tools\Setup;
|
use Doctrine\ORM\Tools\Setup;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
|
|
||||||
require_once 'Doctrine/Common/ClassLoader.php';
|
require_once "vendor/autoload.php";
|
||||||
|
|
||||||
$loader = new \Doctrine\Common\ClassLoader("Doctrine");
|
|
||||||
$loader->register();
|
|
||||||
|
|
||||||
$dbParams = array(
|
$dbParams = array(
|
||||||
'driver' => 'pdo_mysql',
|
'driver' => 'pdo_mysql',
|
||||||
|
@ -33,32 +33,6 @@ use Doctrine\ORM\Mapping\Driver\YamlDriver;
|
|||||||
*/
|
*/
|
||||||
class Setup
|
class Setup
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Use this method to register all autoloaders for a setup where Doctrine is installed
|
|
||||||
* though {@link http://pear.doctrine-project.org}.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function registerAutoloadPEAR()
|
|
||||||
{
|
|
||||||
if (!class_exists('Doctrine\Common\ClassLoader', false)) {
|
|
||||||
require_once "Doctrine/Common/ClassLoader.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
$loader = new ClassLoader("Doctrine");
|
|
||||||
$loader->register();
|
|
||||||
|
|
||||||
$parts = explode(PATH_SEPARATOR, get_include_path());
|
|
||||||
|
|
||||||
foreach ($parts as $includePath) {
|
|
||||||
if ($includePath != "." && file_exists($includePath . "/Doctrine")) {
|
|
||||||
$loader = new ClassLoader("Symfony\Component", $includePath . "/Doctrine");
|
|
||||||
$loader->register();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to register all autoloads for a downloaded Doctrine library.
|
* Use this method to register all autoloads for a downloaded Doctrine library.
|
||||||
* Pick the directory the library was uncompressed into.
|
* Pick the directory the library was uncompressed into.
|
||||||
|
@ -37,15 +37,6 @@ class SetupTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPEARAutoload()
|
|
||||||
{
|
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . "/../../../../../lib/vendor/doctrine-common/lib");
|
|
||||||
|
|
||||||
Setup::registerAutoloadPEAR();
|
|
||||||
|
|
||||||
$this->assertEquals($this->originalAutoloaderCount + 1, count(spl_autoload_functions()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDirectoryAutoload()
|
public function testDirectoryAutoload()
|
||||||
{
|
{
|
||||||
Setup::registerAutoloadDirectory(__DIR__ . "/../../../../../lib/vendor/doctrine-common/lib");
|
Setup::registerAutoloadDirectory(__DIR__ . "/../../../../../lib/vendor/doctrine-common/lib");
|
||||||
|
Loading…
Reference in New Issue
Block a user