Merge pull request #1255 from Ocramius/cleanup/php-5.3-support-end
Cleanup: PHP 5.3 support end
This commit is contained in:
commit
d343617f13
@ -1,7 +1,6 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
|
@ -3,7 +3,7 @@
|
||||
| [![Build status][Master image]][Master] | [![Build status][2.4 image]][2.4] | [![Build status][2.3 image]][2.3] | [![Build status][2.2 image]][2.2] | [![Build status][2.1 image]][2.1] |
|
||||
| [![Coverage Status][Master coverage image]][Master coverage] |
|
||||
|
||||
Doctrine 2 is an object-relational mapper (ORM) for PHP 5.3.2+ that provides transparent persistence
|
||||
Doctrine 2 is an object-relational mapper (ORM) for PHP 5.4+ that provides transparent persistence
|
||||
for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features
|
||||
is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL),
|
||||
inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility
|
||||
|
@ -13,7 +13,7 @@
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"php": ">=5.4",
|
||||
"ext-pdo": "*",
|
||||
"doctrine/collections": "~1.2",
|
||||
"doctrine/dbal": ">=2.5-dev,<2.6-dev",
|
||||
|
@ -18,7 +18,7 @@ well.
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Doctrine 2 requires a minimum of PHP 5.3.0. For greatly improved
|
||||
Doctrine 2 requires a minimum of PHP 5.4. For greatly improved
|
||||
performance it is also recommended that you use APC with PHP.
|
||||
|
||||
Doctrine 2 Packages
|
||||
|
@ -17,7 +17,7 @@ This guide is designed for beginners that haven't worked with Doctrine ORM
|
||||
before. There are some prerequesites for the tutorial that have to be
|
||||
installed:
|
||||
|
||||
- PHP 5.3.3 or above
|
||||
- PHP 5.4 or above
|
||||
- Composer Package Manager (`Install Composer
|
||||
<http://getcomposer.org/doc/00-intro.md>`_)
|
||||
|
||||
@ -32,7 +32,7 @@ What is Doctrine?
|
||||
-----------------
|
||||
|
||||
Doctrine 2 is an `object-relational mapper (ORM)
|
||||
<http://en.wikipedia.org/wiki/Object-relational_mapping>`_ for PHP 5.3.3+ that
|
||||
<http://en.wikipedia.org/wiki/Object-relational_mapping>`_ for PHP 5.4+ that
|
||||
provides transparent persistence for PHP objects. It uses the Data Mapper
|
||||
pattern at the heart, aiming for a complete separation of your domain/business
|
||||
logic from the persistence in a relational database management system.
|
||||
@ -717,8 +717,8 @@ the bi-directional reference:
|
||||
{
|
||||
// ... (previous code)
|
||||
|
||||
protected $reportedBugs = null;
|
||||
protected $assignedBugs = null;
|
||||
private $reportedBugs = null;
|
||||
private $assignedBugs = null;
|
||||
|
||||
public function addReportedBug($bug)
|
||||
{
|
||||
@ -745,10 +745,7 @@ calling Doctrine for persistence would not update the collections
|
||||
representation in the database.
|
||||
|
||||
Only using ``Bug#setEngineer()`` or ``Bug#setReporter()``
|
||||
correctly saves the relation information. We also set both
|
||||
collection instance variables to protected, however with PHP 5.3's
|
||||
new features Doctrine is still able to use Reflection to set and
|
||||
get values from protected and private properties.
|
||||
correctly saves the relation information.
|
||||
|
||||
The ``Bug#reporter`` and ``Bug#engineer`` properties are
|
||||
Many-To-One relations, which point to a User. In a normalized
|
||||
|
@ -470,10 +470,8 @@ abstract class AbstractQuery
|
||||
*/
|
||||
private function translateNamespaces(Query\ResultSetMapping $rsm)
|
||||
{
|
||||
$entityManager = $this->_em;
|
||||
|
||||
$translate = function ($alias) use ($entityManager) {
|
||||
return $entityManager->getClassMetadata($alias)->getName();
|
||||
$translate = function ($alias) {
|
||||
return $this->_em->getClassMetadata($alias)->getName();
|
||||
};
|
||||
|
||||
$rsm->aliasMap = array_map($translate, $rsm->aliasMap);
|
||||
@ -1102,17 +1100,16 @@ abstract class AbstractQuery
|
||||
*/
|
||||
protected function getHash()
|
||||
{
|
||||
$self = $this;
|
||||
$query = $this->getSQL();
|
||||
$hints = $this->getHints();
|
||||
$params = array_map(function(Parameter $parameter) use ($self) {
|
||||
$params = array_map(function(Parameter $parameter) {
|
||||
// Small optimization
|
||||
// Does not invoke processParameterValue for scalar values
|
||||
if (is_scalar($value = $parameter->getValue())) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $self->processParameterValue($value);
|
||||
return $this->processParameterValue($value);
|
||||
}, $this->parameters->getValues());
|
||||
|
||||
ksort($hints);
|
||||
|
@ -558,19 +558,17 @@ class BasicEntityPersister implements EntityPersister
|
||||
public function delete($entity)
|
||||
{
|
||||
$class = $this->class;
|
||||
$em = $this->em;
|
||||
|
||||
$identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
|
||||
$tableName = $this->quoteStrategy->getTableName($class, $this->platform);
|
||||
$idColumns = $this->quoteStrategy->getIdentifierColumnNames($class, $this->platform);
|
||||
$id = array_combine($idColumns, $identifier);
|
||||
$types = array_map(function ($identifier) use ($class, $em) {
|
||||
$types = array_map(function ($identifier) use ($class) {
|
||||
|
||||
if (isset($class->fieldMappings[$identifier])) {
|
||||
return $class->fieldMappings[$identifier]['type'];
|
||||
}
|
||||
|
||||
$targetMapping = $em->getClassMetadata($class->associationMappings[$identifier]['targetEntity']);
|
||||
$targetMapping = $this->em->getClassMetadata($class->associationMappings[$identifier]['targetEntity']);
|
||||
|
||||
if (isset($targetMapping->fieldMappings[$targetMapping->identifier[0]])) {
|
||||
return $targetMapping->fieldMappings[$targetMapping->identifier[0]]['type'];
|
||||
|
@ -123,9 +123,8 @@ class ProxyFactory extends AbstractProxyFactory
|
||||
*/
|
||||
private function createInitializer(ClassMetadata $classMetadata, EntityPersister $entityPersister)
|
||||
{
|
||||
$identifierFlattener = $this->identifierFlattener;
|
||||
if ($classMetadata->getReflectionClass()->hasMethod('__wakeup')) {
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $identifierFlattener) {
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
|
||||
$initializer = $proxy->__getInitializer();
|
||||
$cloner = $proxy->__getCloner();
|
||||
|
||||
@ -156,13 +155,13 @@ class ProxyFactory extends AbstractProxyFactory
|
||||
|
||||
throw EntityNotFoundException::fromClassNameAndIdentifier(
|
||||
$classMetadata->getName(),
|
||||
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
$this->identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $identifierFlattener) {
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
|
||||
$initializer = $proxy->__getInitializer();
|
||||
$cloner = $proxy->__getCloner();
|
||||
|
||||
@ -192,7 +191,7 @@ class ProxyFactory extends AbstractProxyFactory
|
||||
|
||||
throw EntityNotFoundException::fromClassNameAndIdentifier(
|
||||
$classMetadata->getName(),
|
||||
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
$this->identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -210,9 +209,7 @@ class ProxyFactory extends AbstractProxyFactory
|
||||
*/
|
||||
private function createCloner(ClassMetadata $classMetadata, EntityPersister $entityPersister)
|
||||
{
|
||||
$identifierFlattener = $this->identifierFlattener;
|
||||
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $identifierFlattener) {
|
||||
return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) {
|
||||
if ($proxy->__isInitialized()) {
|
||||
return;
|
||||
}
|
||||
@ -227,7 +224,7 @@ class ProxyFactory extends AbstractProxyFactory
|
||||
if (null === $original) {
|
||||
throw EntityNotFoundException::fromClassNameAndIdentifier(
|
||||
$classMetadata->getName(),
|
||||
$identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
$this->identifierFlattener->flattenIdentifier($classMetadata, $identifier)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -907,23 +907,23 @@ public function __construct(<params>)
|
||||
*/
|
||||
protected function getTraits(ClassMetadataInfo $metadata)
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50400 && ($metadata->reflClass !== null || class_exists($metadata->name))) {
|
||||
$reflClass = $metadata->reflClass === null
|
||||
? new \ReflectionClass($metadata->name)
|
||||
: $metadata->reflClass;
|
||||
|
||||
$traits = array();
|
||||
|
||||
while ($reflClass !== false) {
|
||||
$traits = array_merge($traits, $reflClass->getTraits());
|
||||
|
||||
$reflClass = $reflClass->getParentClass();
|
||||
}
|
||||
|
||||
return $traits;
|
||||
if (! ($metadata->reflClass !== null || class_exists($metadata->name))) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array();
|
||||
$reflClass = $metadata->reflClass === null
|
||||
? new \ReflectionClass($metadata->name)
|
||||
: $metadata->reflClass;
|
||||
|
||||
$traits = array();
|
||||
|
||||
while ($reflClass !== false) {
|
||||
$traits = array_merge($traits, $reflClass->getTraits());
|
||||
|
||||
$reflClass = $reflClass->getParentClass();
|
||||
}
|
||||
|
||||
return $traits;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,15 +213,11 @@ class AnnotationDriverTest extends AbstractMappingDriverTest
|
||||
|
||||
$this->setExpectedException('Doctrine\Common\Annotations\AnnotationException',
|
||||
'[Enum Error] Attribute "fetch" of @Doctrine\ORM\Mapping\OneToMany declared on property Doctrine\Tests\ORM\Mapping\InvalidFetchOption::$collection accept only [LAZY, EAGER, EXTRA_LAZY], but got eager.');
|
||||
$cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\InvalidFetchOption');
|
||||
$factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\InvalidFetchOption');
|
||||
}
|
||||
|
||||
public function testAttributeOverridesMappingWithTrait()
|
||||
{
|
||||
if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
||||
$this->markTestSkipped('This test is only for 5.4+.');
|
||||
}
|
||||
|
||||
$factory = $this->createClassMetadataFactory();
|
||||
|
||||
$metadataWithoutOverride = $factory->getMetadataFor('Doctrine\Tests\Models\DDC1872\DDC1872ExampleEntityWithoutOverride');
|
||||
|
@ -704,10 +704,6 @@ class EntityGeneratorTest extends OrmTestCase
|
||||
*/
|
||||
public function testTraitPropertiesAndMethodsAreNotDuplicated()
|
||||
{
|
||||
if (PHP_VERSION_ID < 50400) {
|
||||
$this->markTestSkipped('Traits are not available before php 5.4.');
|
||||
}
|
||||
|
||||
$cmf = new ClassMetadataFactory();
|
||||
$em = $this->_getTestEntityManager();
|
||||
$cmf->setEntityManager($em);
|
||||
@ -734,10 +730,6 @@ class EntityGeneratorTest extends OrmTestCase
|
||||
*/
|
||||
public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses()
|
||||
{
|
||||
if (PHP_VERSION_ID < 50400) {
|
||||
$this->markTestSkipped('Traits are not available before php 5.4.');
|
||||
}
|
||||
|
||||
$cmf = new ClassMetadataFactory();
|
||||
$em = $this->_getTestEntityManager();
|
||||
$cmf->setEntityManager($em);
|
||||
|
Loading…
Reference in New Issue
Block a user