Commit daa1ecde authored by catch's avatar catch

Issue #1683046 by Rob Loach, effulgentsia: Add the Doctrine Common PHP library.

parent 14bbd98a
......@@ -7,7 +7,8 @@
"symfony/http-kernel": "2.1.*",
"symfony/routing": "2.1.*",
"symfony/yaml": "2.1.*",
"twig/twig": "1.8.*"
"twig/twig": "1.8.*",
"doctrine/common": "2.2.*"
},
"minimum-stability": "beta"
}
{
"hash": "ec77094fc475b57afb7a27f63983ead1",
"hash": "2ea132b64c01235b70e9fb16c528ea0e",
"packages": [
{
"package": "doctrine/common",
"version": "2.2.2"
},
{
"package": "symfony/class-loader",
"version": "v2.1.0-BETA1"
......
......@@ -3048,6 +3048,7 @@ function drupal_classloader() {
'Symfony\Component\HttpKernel' => DRUPAL_ROOT . '/core/vendor/symfony/http-kernel',
'Symfony\Component\Routing' => DRUPAL_ROOT . '/core/vendor/symfony/routing',
'Symfony\Component\Yaml' => DRUPAL_ROOT . '/core/vendor/symfony/yaml',
'Doctrine\Common' => DRUPAL_ROOT . '/core/vendor/doctrine/common/lib',
));
// Register PEAR-style vendor namespaces.
$loader->registerPrefixes(array(
......
......@@ -102,7 +102,7 @@ public function add($prefix, $paths)
/**
* Turns on searching the include path for class files.
*
* @param Boolean $useIncludePath
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
......@@ -113,7 +113,7 @@ public function setUseIncludePath($useIncludePath)
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return Boolean
* @return bool
*/
public function getUseIncludePath()
{
......@@ -123,7 +123,7 @@ public function getUseIncludePath()
/**
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
......@@ -141,13 +141,13 @@ public function unregister()
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return Boolean|null True, if loaded
* @param string $class The name of the class
* @return bool|null True, if loaded
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;
include $file;
return true;
}
......
......@@ -14,4 +14,5 @@
'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/',
'Symfony\\Component\\DependencyInjection' => $vendorDir . '/symfony/dependency-injection/',
'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/',
'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/',
);
......@@ -3,7 +3,7 @@
"name": "twig/twig",
"version": "v1.8.3",
"version_normalized": "1.8.3.0",
"time": "2012-06-17 18:48:16",
"time": "2012-06-18 01:48:16",
"source": {
"type": "git",
"url": "git://github.com/fabpot/Twig.git",
......@@ -58,7 +58,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/DependencyInjection",
"time": "2012-06-12 11:59:42",
"time": "2012-06-12 18:59:42",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection",
......@@ -108,7 +108,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/EventDispatcher",
"time": "2012-05-15 16:56:32",
"time": "2012-05-15 23:56:32",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher",
......@@ -155,7 +155,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/HttpFoundation",
"time": "2012-06-12 06:10:53",
"time": "2012-06-12 13:10:53",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation",
......@@ -202,7 +202,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/HttpKernel",
"time": "2012-06-12 11:59:42",
"time": "2012-06-12 18:59:42",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel",
......@@ -259,7 +259,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/Routing",
"time": "2012-06-12 11:59:42",
"time": "2012-06-12 18:59:42",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing",
......@@ -310,7 +310,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/Yaml",
"time": "2012-06-09 15:04:17",
"time": "2012-06-09 22:04:17",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml",
......@@ -357,7 +357,7 @@
"version": "v2.1.0-BETA1",
"version_normalized": "2.1.0.0-beta1",
"target-dir": "Symfony/Component/ClassLoader",
"time": "2012-04-23 05:37:21",
"time": "2012-04-23 12:37:21",
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader",
......@@ -398,5 +398,76 @@
"Symfony\\Component\\ClassLoader": ""
}
}
},
{
"name": "doctrine/common",
"version": "2.2.2",
"version_normalized": "2.2.2.0",
"time": "2012-04-13 07:46:44",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common",
"reference": "2.2.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/doctrine/common/zipball/2.2.2",
"reference": "2.2.2",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"installation-source": "dist",
"license": [
"LGPL"
],
"authors": [
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": null
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com",
"homepage": null,
"role": null
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org",
"homepage": null,
"role": null
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de",
"homepage": null,
"role": null
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "https://github.com/schmittjoh",
"role": null
}
],
"description": "Common Library for Doctrine projects",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"collections",
"spl",
"eventmanager",
"annotations",
"persistence"
],
"autoload": {
"psr-0": {
"Doctrine\\Common": "lib/"
}
}
}
]
build/
logs/
reports/
dist/
[submodule "lib/vendor/doctrine-build-common"]
path = lib/vendor/doctrine-build-common
url = git://github.com/doctrine/doctrine-build-common.git
language: php
php:
- 5.3
- 5.4
This diff is collapsed.
# Doctrine Common
[![Build Status](https://secure.travis-ci.org/doctrine/common.png)](http://travis-ci.org/doctrine/common)
The Doctrine Common project is a library that provides extensions to core PHP functionality.
## More resources:
* [Website](http://www.doctrine-project.org)
* [Documentation](http://www.doctrine-project.org/projects/common/current/docs/en)
* [Issue Tracker](http://www.doctrine-project.org/jira/browse/DCOM)
* [Downloads](http://github.com/doctrine/common/downloads)
This document details all the possible changes that you should investigate when updating
your project from Doctrine Common 2.0.x to 2.1
## AnnotationReader changes
The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory the operation of the new reader should be backwards compatible, but it has to be setup differently to work that way:
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
// new code necessary starting here
$reader->setIgnoreNotImportedAnnotations(true);
$reader->setEnableParsePhpImports(false);
$reader = new \Doctrine\Common\Annotations\CachedReader(
new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()
);
## Annotation Base class or @Annotation
Beginning after 2.1-RC2 you have to either extend ``Doctrine\Common\Annotations\Annotation`` or add @Annotation to your annotations class-level docblock, otherwise the class will simply be ignored.
## Removed methods on AnnotationReader
* AnnotationReader::setAutoloadAnnotations()
* AnnotationReader::getAutoloadAnnotations()
* AnnotationReader::isAutoloadAnnotations()
## AnnotationRegistry
Autoloading through the PHP autoloader is removed from the 2.1 AnnotationReader. Instead you have to use the global AnnotationRegistry for loading purposes:
\Doctrine\Common\Annotations\AnnotationRegistry::registerFile($fileWithAnnotations);
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($namespace, $dirs = null);
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespaces($namespaces);
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader($callable);
The $callable for registering a loader accepts a class as first and only parameter and must try to silently autoload it. On success true has to be returned.
The registerAutoloadNamespace function registers a PSR-0 compatible silent autoloader for all classes with the given namespace in the given directories.
If null is passed as directory the include path will be used.
This document details all the possible changes that you should investigate when
updating your project from Doctrine Common 2.1 to 2.2:
## Annotation Changes
- AnnotationReader::setIgnoreNotImportedAnnotations has been removed, you need to
add ignore annotation names which are supposed to be ignored via
AnnotationReader::addGlobalIgnoredName
- AnnotationReader::setAutoloadAnnotations was deprecated by the AnnotationRegistry
in 2.1 and has been removed in 2.2
- AnnotationReader::setEnableParsePhpImports was added to ease transition to the new
annotation mechanism in 2.1 and is removed in 2.2
- AnnotationReader::isParsePhpImportsEnabled is removed (see above)
- AnnotationReader::setDefaultAnnotationNamespace was deprecated in favor of explicit
configuration in 2.1 and will be removed in 2.2 (for isolated projects where you
have full-control over _all_ available annotations, we offer a dedicated reader
class ``SimpleAnnotationReader``)
- AnnotationReader::setAnnotationCreationFunction was deprecated in 2.1 and will be
removed in 2.2. We only offer two creation mechanisms which cannot be changed
anymore to allow the same reader instance to work with all annotations regardless
of which library they are coming from.
- AnnotationReader::setAnnotationNamespaceAlias was deprecated in 2.1 and will be
removed in 2.2 (see setDefaultAnnotationNamespace)
- If you use a class as annotation which has not the @Annotation marker in it's
class block, we will now throw an exception instead of silently ignoring it. You
can however still achieve the previous behavior using the @IgnoreAnnotation, or
AnnotationReader::addGlobalIgnoredName (the exception message will contain detailed
instructions when you run into this problem).
## Cache Changes
- Renamed old AbstractCache to CacheProvider
- Dropped the support to the following functions of all cache providers:
- CacheProvider::deleteByWildcard
- CacheProvider::deleteByRegEx
- CacheProvider::deleteByPrefix
- CacheProvider::deleteBySuffix
- CacheProvider::deleteAll will not remove ALL entries, it will only mark them as invalid
- CacheProvider::flushAll will remove ALL entries, namespaced or not
- Added support to MemcachedCache
- Added support to WincacheCache
## ClassLoader Changes
- ClassLoader::fileExistsInIncludePath() no longer exists. Use the native stream_resolve_include_path() PHP function
\ No newline at end of file
# Project Name
project.name=DoctrineCommon
# Version class and file
project.version_class = Doctrine\Common\Version
project.version_file = lib/Doctrine/Common/Version.php
<?xml version="1.0"?>
<project name="Doctrine2" default="build" basedir=".">
<taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
<import file="${project.basedir}/lib/vendor/doctrine-build-common/packaging.xml" />
<property file="build.properties" />
<!--
Fileset for artifacts shared across all distributed packages.
-->
<fileset id="shared-artifacts" dir=".">
<include name="LICENSE"/>
<include name="COPYRIGHT"/>
<include name="CHANGELOG"/>
</fileset>
<!--
Fileset for the sources of the Doctrine Common package.
-->
<fileset id="common-sources" dir="./lib">
<include name="Doctrine/Common/**"/>
</fileset>
<!--
Builds Common package, preparing it for distribution.
-->
<target name="copy-files" depends="prepare">
<copy todir="${build.dir}/${project.name}-${version}">
<fileset refid="shared-artifacts"/>
</copy>
<copy todir="${build.dir}/${project.name}-${version}">
<fileset refid="common-sources"/>
</copy>
</target>
<!--
Builds distributable PEAR packages.
-->
<target name="define-pear-package" depends="copy-files">
<d51pearpkg2 baseinstalldir="/" dir="${build.dir}/${project.name}-${version}">
<name>DoctrineCommon</name>
<summary>Doctrine Common PHP Extensions</summary>
<channel>pear.doctrine-project.org</channel>
<description>The Doctrine Common package contains shared code between the other packages.</description>
<lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
<lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
<lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
<lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
<license>LGPL</license>
<version release="${pear.version}" api="${pear.version}" />
<stability release="${pear.stability}" api="${pear.stability}" />
<notes>-</notes>
<dependencies>
<php minimum_version="5.3.0" />
<pear minimum_version="1.6.0" recommended_version="1.6.1" />
</dependencies>
</d51pearpkg2>
</target>
</project>
{
"name": "doctrine/common",
"type": "library","version":"2.2.2",
"description": "Common Library for Doctrine projects",
"keywords": ["collections", "spl", "eventmanager", "annotations", "persistence"],
"homepage": "http://www.doctrine-project.org",
"license": "LGPL",
"authors": [
{"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
{"name": "Roman Borschel", "email": "roman@code-factory.org"},
{"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"},
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"},
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": ">=5.3.2"
},
"autoload": {
"psr-0": { "Doctrine\\Common": "lib/" }
}
}
<?php
/*
* 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.doctrine-project.org>.
*/
namespace Doctrine\Common\Annotations;
/**
* Annotations class
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class Annotation
{
/**
* Value property. Common among all derived classes.
*
* @var string
*/
public $value;
/**
* Constructor
*
* @param array $data Key-value for properties to be defined in this class
*/
public final function __construct(array $data)
{
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
/**
* Error handler for unknown property accessor in Annotation class.
*
* @param string $name Unknown property name
*/
public function __get($name)
{
throw new \BadMethodCallException(
sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
);
}
/**
* Error handler for unknown property mutator in Annotation class.
*
* @param string $name Unkown property name
* @param mixed $value Property value
*/
public function __set($name, $value)
{
throw new \BadMethodCallException(
sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this))
);
}
}
\ No newline at end of file
<?php
/*
* 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.doctrine-project.org>.
*/
namespace Doctrine\Common\Annotations\Annotation;
/**
* Annotation that can be used to signal to the parser
* to check the attribute type during the parsing process.
*
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
*
* @Annotation
*/
final class Attribute
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $type;
/**
* @var boolean
*/
public $required = false;
}
\ No newline at end of file
<?php
/*
* 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.doctrine-project.org>.
*/
namespace Doctrine\Common\Annotations\Annotation;
/**
* Annotation that can be used to signal to the parser
* to check the types of all declared attributes during the parsing process.
*
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
*
* @Annotation
*/
final class Attributes
{
/**
* @var array<Doctrine\Common\Annotations\Annotation\Attribute>
*/
public $value;
}
\ No newline at end of file
<?php
/*
* 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.doctrine-project.org>.
*/
namespace Doctrine\Common\Annotations\Annotation;
/**
* Annotation that can be used to signal to the parser to ignore specific
* annotations during the parsing process.
*
* @Annotation