Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where xml mapping cannot find file on certain configurations #6254

Closed
wants to merge 137 commits into from
Closed
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
c8a56bd
Removed ClassMetadataInfo. Before suite run: 7.19 seconds. After: 6.7…
guilhermeblanco May 6, 2016
a5400b7
Renamed setIdentifierValues to assignIdentifier
guilhermeblanco May 6, 2016
6e02e6e
Removed ClassMetadata::$columnNames. Improved overall test suite by 1…
guilhermeblanco May 6, 2016
4d80a63
Removed ClassMetadata::$namespace
guilhermeblanco May 6, 2016
cb675a1
Removed ClassMetadata::$fieldMappings[$field][requireSQLConversion]
guilhermeblanco May 7, 2016
bcf187b
Removed ClassMetadata::getTypeOfColumn() method
guilhermeblanco May 7, 2016
f30a832
Optimized EntityPersister::getSelectColumnSQL() and EntityInheritance…
guilhermeblanco May 7, 2016
37f9cfc
Some CS fixes
guilhermeblanco May 7, 2016
bb6d233
ClassMetadata::[]['type'] now holds a Type instance instead of string
guilhermeblanco May 7, 2016
943025b
$this->assertXXX changes to self::assertXXX as PHPUnit test methods a…
guilhermeblanco May 7, 2016
9a3ba30
Added declaringClass and fixed almost all unit tests with the excepti…
guilhermeblanco May 8, 2016
c9e15ba
Finalized inclusion of support for declaringClass
guilhermeblanco May 13, 2016
d7da78c
Switched getSQLTableAlias to use table names instead of class names
guilhermeblanco May 14, 2016
b92d2db
Made fields, associations, join columns, version fields, identifiers,…
guilhermeblanco May 14, 2016
6a0d840
Added tableName on fields, association join columns and embeddeds.
guilhermeblanco May 14, 2016
39f0ce2
Fix for tableName in STI
guilhermeblanco May 14, 2016
45d8106
Upgrade file
guilhermeblanco May 16, 2016
84573ef
Fixed unit test
guilhermeblanco May 16, 2016
da53be0
Fixed unit test
guilhermeblanco May 16, 2016
00f3ef1
Initial code for FieldMetadata
guilhermeblanco May 17, 2016
720a57c
Commented embeddeds support until fields are complete. Embeddeds will…
guilhermeblanco May 17, 2016
b085233
Moved all mapField to addProperty
guilhermeblanco May 18, 2016
c2b2953
Added InheritedFieldMetadata and got rid of most fieldMappings in the…
guilhermeblanco May 20, 2016
13c0fd3
More work related to FieldMetadata and InheritedFieldMetadata
guilhermeblanco May 20, 2016
7f78b11
Fixed a bunch of unit tests
guilhermeblanco May 20, 2016
2c8b74a
Converted ClassMetadtaa::setVersionMapping to use FieldMetadata inste…
guilhermeblanco May 20, 2016
5aafa0f
More fixed unit tests
guilhermeblanco May 20, 2016
fe16d8b
Removed quoting support and make sure we always quote data. Still mis…
guilhermeblanco May 20, 2016
d66b63e
Removed traces of fieldMappings from codebase
guilhermeblanco May 21, 2016
3ceef5c
Removed unused methods
guilhermeblanco May 21, 2016
60c1c47
Requiring PHPBench for performance testing
Ocramius May 26, 2016
8c26f27
Not a performance test
Ocramius May 26, 2016
327196a
PHPBench base config
Ocramius May 26, 2016
bec59ff
Benchmark autoloading definitions
Ocramius May 26, 2016
dcb633c
Factory used to create a new entity manager
Ocramius May 26, 2016
1fc107c
Simple array hydration benchmark
Ocramius May 26, 2016
64db61a
Full hydration + query benchmark
Ocramius May 26, 2016
b723c0a
Array hydration benchmark
Ocramius May 26, 2016
c737e64
Testing mixed array hydration (with scalars and fetch-joined results)
Ocramius May 26, 2016
dc58fec
CS (alignment)
Ocramius May 26, 2016
fd314f4
Renaming bench methods, for clarity
Ocramius May 26, 2016
0b582cf
Partial hydration bench
Ocramius May 26, 2016
921858e
Full object hydration benchmark
Ocramius May 26, 2016
1176e61
Removing unused `$entityManager` variable
Ocramius May 26, 2016
09f0265
Benchmarking mixed fetch-join with partial hydration
Ocramius May 26, 2016
be396dc
Benchmarking full object hydration with fetch joins and mixed values
Ocramius May 26, 2016
554fb16
Removing old `HydrationPerformanceTest`
Ocramius May 26, 2016
02f6b01
Benchmarking simple insert operations (batched)
Ocramius May 26, 2016
6fbf202
Corrected class name - needs to end with `Bench`
Ocramius May 26, 2016
2186675
Removing useless imports
Ocramius May 26, 2016
5973e4f
Removed old `InsertPerformanceTest` (moved to benchmark)
Ocramius May 26, 2016
31e1a00
Removing instantiation overhead from benchmark
Ocramius May 26, 2016
0b4f642
Benchmarking insert operations for a JTI
Ocramius May 26, 2016
65ea8a0
Corrected benchmark name: benchmark affects a STI
Ocramius May 26, 2016
b1e78c9
Benchmarking hydration of a STI
Ocramius May 26, 2016
367c96a
Removing old inheritance persister test
Ocramius May 26, 2016
11d8d18
Removing old `PersisterPerformanceTest`
Ocramius May 26, 2016
a1a7bc5
Unit of work changeset computation test
Ocramius May 26, 2016
55a6afa
Removing old `UnitOfWorkPerformanceTest`
Ocramius May 26, 2016
a44dbef
The `SecondLevelCacheTest` is actually a test that verifies amount of…
Ocramius May 26, 2016
2c7c6cc
Benchmarking instantiation of proxies
Ocramius May 26, 2016
dd38327
Benchmarking proxy initialization logic
Ocramius May 26, 2016
0fdc7e6
Mocks required by the proxy performance benchmarks
Ocramius May 26, 2016
27baba6
Removing old `ProxyPerformanceTest`
Ocramius May 26, 2016
b638eaf
More work towards FieldMetadata
guilhermeblanco May 26, 2016
ffe0ecc
No more errors (just failures) for FieldMetadata
guilhermeblanco May 26, 2016
4251730
Normalized quote strategy execution for discriminator columns and joi…
guilhermeblanco May 27, 2016
54ee39f
Refactored QuoteStrategy::getColumnName()
guilhermeblanco May 28, 2016
2992bcf
Merged FieldMetadata and InheritedFieldMetadata into a single unit
guilhermeblanco May 31, 2016
bced1b4
Quick improvements
guilhermeblanco Jun 2, 2016
da27c9d
Decoupled FieldMetadata into FieldMetadata and ColumnMetadata
guilhermeblanco Jun 4, 2016
32ff66a
Moved Discriminator Column to OO approach and refactored a bit for pe…
guilhermeblanco Jun 8, 2016
8f56726
Finalized changes to ensure everything breaking now is due to quoting…
guilhermeblanco Jun 9, 2016
814e3e1
Removed isVersioned property.
guilhermeblanco Jun 10, 2016
3ee4f03
Switched versionField to versionProperty
guilhermeblanco Jun 10, 2016
146c75c
Removed the need for FielMetadata::$currentClass property
guilhermeblanco Jun 12, 2016
d0e5697
Cosmetic
guilhermeblanco Jun 12, 2016
86d30e2
Cosmetic
guilhermeblanco Jun 12, 2016
6b1d34f
Removed isCascadeXXX
guilhermeblanco Jul 4, 2016
1b072f7
Breaking everything with start migration to use ClassMetadataBuilder …
guilhermeblanco Jul 5, 2016
7ba2259
More work related to ClassMetadataBuilder changes and some fixes to b…
guilhermeblanco Jul 8, 2016
f90b83c
Fixes to bugs and made test more consistent
guilhermeblanco Jul 9, 2016
679b46a
Fixes and implemented incomplete tests
guilhermeblanco Jul 11, 2016
c65a5e9
Fix for test
guilhermeblanco Jul 11, 2016
6432890
Removed some methods from QuoteStrategy (beginning of the end of quot…
guilhermeblanco Jul 12, 2016
45035ba
Removing Doctrine ORM 1 schema conversion tool.
lcobucci Jul 12, 2016
e8d6ee1
Removing YAML class metadata exporter and its references.
lcobucci Jul 12, 2016
9b659c8
Removing YAML drivers and all its references.
lcobucci Jul 12, 2016
32842c6
Removing YAML mappings on docblocks and messages.
lcobucci Jul 12, 2016
50452fa
Adding YAML removal as BC break.
lcobucci Jul 12, 2016
182ae58
s/should/**MUST** as per @afoeder's review
Ocramius Jul 13, 2016
f0a2370
More work around JoinColumns. Should start AssociationMetadata change…
guilhermeblanco Jul 20, 2016
08829cd
Introduced JoinColumnMetadata and refactored most tests. Still 14 fai…
guilhermeblanco Aug 11, 2016
c3bdb15
Starting the concept of Builders on Drivers
guilhermeblanco Aug 26, 2016
4174260
Fixing remaining possible to be fixed unit tests
guilhermeblanco Aug 27, 2016
296d23c
Strict types
guilhermeblanco Aug 27, 2016
8077d05
Merged sequenceGeneratorDefinition and customGeneratorDefinition into…
guilhermeblanco Aug 30, 2016
67a0c3c
Checks for references, proxies and retrievals on EM. Removed todo fro…
guilhermeblanco Aug 30, 2016
21c51f5
Simplified property inheritance logic when loading class metadata
guilhermeblanco Aug 30, 2016
c20298d
Moved FieldMetadata creation out of ClassMetadata
guilhermeblanco Sep 7, 2016
db1c252
Allow unique index creation from ORM mapping
guilhermeblanco Sep 14, 2016
7fc1017
Decoupled unique constraint from unique index
guilhermeblanco Sep 22, 2016
f95f51b
Introduced concept of TableMetadata. Still a few tests to finish fixing
guilhermeblanco Oct 4, 2016
545c76d
Finalized TableMetadata implementation
guilhermeblanco Oct 5, 2016
fada6e7
Removed QuoteStrategy::getTableName()
guilhermeblanco Oct 6, 2016
b032b39
Implemented JoinTableMetadata
guilhermeblanco Oct 8, 2016
07bdedb
Removed support for joinColumnFieldNames
guilhermeblanco Oct 13, 2016
01efeb1
Removed most of targetToSourceKeyColumns usages
guilhermeblanco Oct 21, 2016
13e288d
Eliminated targetToSourceKeyColumns from association mapping
guilhermeblanco Oct 21, 2016
a934075
Eliminated sourceToTargetKeyColumns from association mapping
guilhermeblanco Oct 21, 2016
d1a25eb
Removed relationToTargetKeyColumns and relationToSourceKeyColumns fro…
guilhermeblanco Oct 22, 2016
c5eb278
Removed ClassMetadata::FETCH_* constants and created FetchMode::*
guilhermeblanco Oct 22, 2016
aa7fd84
Removed ClassMetadata::CACHE_USAGE_* constants and created CacheUsage::*
guilhermeblanco Oct 22, 2016
fdea419
Removed ClassMetadata::INHERITANCE_TYPE_* constants and created Inher…
guilhermeblanco Oct 22, 2016
b42779f
Removed ClassMetadata::CHANGETRACKING_* constants and created ChangeT…
guilhermeblanco Oct 22, 2016
e64831d
Removed ClassMetadata::GENERATOR_TYPE_* constants and created Generat…
guilhermeblanco Oct 23, 2016
0bd720c
Removed code duplication of helper methods, inlining calls.
guilhermeblanco Oct 23, 2016
81e26fa
More optimizations and cleanup
guilhermeblanco Oct 23, 2016
b654247
EntityManager::transactional() returns value returned by the closure
enumag Nov 24, 2016
7fb313d
EntityManager::transactional() uses callable type-hint
enumag Nov 24, 2016
f81e2a9
EntityManager::transactional() catches Throwable
enumag Nov 24, 2016
f7bbcf6
Refactor EntityManagerTest
enumag Nov 24, 2016
9083501
EntityManager::transactional() doesn't use call_user_func
enumag Nov 24, 2016
b514260
Fix typehints in EntityManagerInterface implementations
enumag Nov 24, 2016
d8ff673
Required development version of DBAL
lcobucci Dec 9, 2016
23e6967
Use objects instead of arrays for join tables and columns
lcobucci Dec 9, 2016
1f32d8e
Fixed DDC-536 (GH #5044). Remove the _ prefix from private and protec…
guilhermeblanco Jan 10, 2017
fdd3ff7
Fixes #5855. Removed ability to EntityManager::clear($entityName), cl…
guilhermeblanco Jan 10, 2017
7382808
Optimizations improvement over clear()
guilhermeblanco Jan 12, 2017
ae61b74
Introduced CacheMetadata
guilhermeblanco Jan 13, 2017
b29f41f
Renamed ClassMetadata->enableCache to ClasMetadata->setCache
guilhermeblanco Jan 14, 2017
26626aa
Improvement over last commit
guilhermeblanco Jan 14, 2017
5dc859e
CacheMetadata is now immutable
guilhermeblanco Jan 14, 2017
312f631
Removed ClassMetadata->containsForeignIdentifier
guilhermeblanco Jan 14, 2017
7cb41fa
Added foreign key columns to the maps of columns to property names.
guilhermeblanco Jan 17, 2017
f5ccfe1
Fix issue where xml mapping cannot find file on certain configurations
Jan 25, 2017
cc3fd00
Inline fix
Jan 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sudo: false
language: php

php:
- 5.6
- 7.0
- 7.1
- nightly
Expand All @@ -14,7 +13,6 @@ env:

before_script:
- if [[ $TRAVIS_PHP_VERSION = '7.0' && $DB = 'sqlite' ]]; then PHPUNIT_FLAGS="--coverage-clover ./build/logs/clover.xml"; else PHPUNIT_FLAGS=""; fi
- if [[ $TRAVIS_PHP_VERSION -lt '7.0' && $TRAVIS_PHP_VERSION != 'hhv*' ]]; then phpenv config-rm xdebug.ini; fi
- composer self-update
- composer install --prefer-source

Expand All @@ -29,10 +27,6 @@ after_script:
matrix:
fast_finish: true
include:
- php: 5.6
env: DB=mariadb
addons:
mariadb: 10.1
- php: 7.0
env: DB=mariadb
addons:
Expand Down
108 changes: 106 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,97 @@
# Upgrade to 3.0

## BC Break: Removed ``YAML`` mapping drivers.

If your code relies on ``YamlDriver`` or ``SimpleYamlDriver``, you **MUST** change to
annotation or XML drivers instead.

## BC Break: Changed methods in ``ClassMetadata``

* ``ClassMetadata::addInheritedProperty``
* ``ClassMetadata::setDiscriminatorColumn``

## BC Break: Removed methods in ``ClassMetadata``

* ``ClassMetadata::getTypeOfField`` (to be removed, part of Common API)

## BC Break: Removed methods in ``ClassMetadata``

* ``ClassMetadata::setTableName`` => Use ``ClassMetadata::setPrimaryTable(['name' => ...])``
* ``ClassMetadata::getFieldMapping`` => Use ``ClassMetadata::getProperty()`` and its methods
* ``ClassMetadata::getQuotedColumnName`` => Use ``ClassMetadata::getProperty()::getQuotedColumnName()``
* ``ClassMetadata::getQuotedTableName``
* ``ClassMetadata::getQuotedJoinTableName``
* ``ClassMetadata::getQuotedIdentifierColumnNames``
* ``ClassMetadata::getIdentifierColumnNames`` => Use ``ClassMetadata::getIdentifierColumns($entityManager)``
* ``ClassMetadata::setVersionMetadata`` => Use ``ClassMetadata::setVersionProperty``
* ``ClassMetadata::setVersioned``
* ``ClassMetadata::invokeLifecycleCallbacks``
* ``ClassMetadata::isInheritedField`` => Use ``ClassMetadata::getProperty()::isInherited()``
* ``ClassMetadata::isUniqueField`` => Use ``ClassMetadata::getProperty()::isUnique()``
* ``ClassMetadata::isNullable`` => Use ``ClassMetadata::getProperty()::isNullable()``
* ``ClassMetadata::getTypeOfColumn()`` => Use ``PersisterHelper::getTypeOfColumn()``

## BC Break: Removed ``quoted`` index from table, field and sequence mappings

Quoting is now always called. Implement your own ``Doctrine\ORM\Mapping\NamingStrategy`` to manipulate
your schema, tables and column names to your custom desired naming convention.

## BC Break: Removed ``ClassMetadata::$fieldMappings[$fieldName]['requireSQLConversion']``

ORM Type SQL conversion is now always being applied, minimizing the risks of error prone code in ORM internals

## BC Break: Removed ``ClassMetadata::$columnNames``

If your code relies on this property, you should search/replace from this:

$metadata->columnNames[$fieldName]

To this:

$metadata->getProperty($fieldName)->getColumnName()

## BC Break: Renamed ``ClassMetadata::setIdentifierValues()`` to ``ClassMetadata::assignIdentifier()``

Provides a more meaningful name to method.

## BC Break: Removed ``ClassMetadata::$namespace``

The namespace property in ClassMetadata was only used when using association
classes in the same namespace and it was used to speedup ClassMetadata
creation purposes. Namespace could be easily inferred by asking ``\ReflectionClass``
which was already stored internally.

### BC Break: Removed ``ClassMetadata::$isVersioned``

Switched to a method alternative: ``ClassMetadata::isVersioned()``

## BC Break: Removed ``Doctrine\ORM\Mapping\ClassMetadataInfo``

There was no reason to keep a blank class. All references are now pointing
to ``Doctrine\ORM\Mapping\ClassMetadata``.

## BC Break: Annotations classes namespace change

All Annotations classes got moved from ``Doctrine\ORM\Mapping`` into a more
pertinent namespace ``Doctrine\ORM\Annotation``. This change was done to add
room for Metadata namespace refactoring.

## Minor BC break: Mappings now store DBAL\Type instances instead of strings

This lead to manual ``ResultSetMapping`` building instances to also hold Types in meta results.
Example:

$rsm->addMetaResult('e ', 'e_discr', 'discr', false, Type::getType('string'));

## Enhancement: Mappings now store their declaring ClassMetadata

Every field, association or embedded now contains a pointer to its declaring ClassMetadata.

## Enhancement: Mappings now store their corresponding table name

Every field, association join column or inline embedded field/association holds a reference to its owning table name.


# Upgrade to 2.5

## Minor BC BREAK: query cache key time is now a float
Expand Down Expand Up @@ -148,6 +242,7 @@ From now on, the resultset will look like this:

Added way to access the underlying QueryBuilder#from() method's 'indexBy' parameter when using EntityRepository#createQueryBuilder()


# Upgrade to 2.4

## BC BREAK: Compatibility Bugfix in PersistentCollection#matching()
Expand Down Expand Up @@ -192,6 +287,7 @@ Now parenthesis are considered, the previous DQL will generate:

SELECT 100 / (2 * 2) FROM my_entity


# Upgrade to 2.3

## Auto Discriminator Map breaks userland implementations with Listener
Expand Down Expand Up @@ -261,6 +357,7 @@ Also, following mapping drivers have been deprecated, please use their replaceme
* `Doctrine\ORM\Mapping\Driver\PHPDriver` => `Doctrine\Common\Persistence\Mapping\Driver\PHPDriver`
* `Doctrine\ORM\Mapping\Driver\StaticPHPDriver` => `Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver`


# Upgrade to 2.2

## ResultCache implementation rewritten
Expand Down Expand Up @@ -344,6 +441,7 @@ Also, Doctrine 2.2 now is around 10-15% faster than 2.1.

Previously EntityManager#find(null) returned null. It now throws an exception.


# Upgrade to 2.1

## Interface for EntityRepository
Expand All @@ -368,6 +466,7 @@ The annotation reader was heavily refactored between 2.0 and 2.1-RC1. In theory

This is already done inside the ``$config->newDefaultAnnotationDriver``, so everything should automatically work if you are using this method. You can verify if everything still works by executing a console command such as schema-validate that loads all metadata into memory.


# Update from 2.0-BETA3 to 2.0-BETA4

## XML Driver <change-tracking-policy /> element demoted to attribute
Expand All @@ -376,6 +475,7 @@ We changed how the XML Driver allows to define the change-tracking-policy. The w

<entity change-tracking-policy="DEFERRED_IMPLICT" />


# Update from 2.0-BETA2 to 2.0-BETA3

## Serialization of Uninitialized Proxies
Expand Down Expand Up @@ -438,10 +538,12 @@ don't loose anything through this.
The default allocation size for sequences has been changed from 10 to 1. This step was made
to not cause confusion with users and also because it is partly some kind of premature optimization.


# Update from 2.0-BETA1 to 2.0-BETA2

There are no backwards incompatible changes in this release.


# Upgrade from 2.0-ALPHA4 to 2.0-BETA1

## EntityRepository deprecates access to protected variables
Expand Down Expand Up @@ -512,7 +614,6 @@ access all entities.

Xml and Yaml Drivers work as before!


## New inversedBy attribute

It is now *mandatory* that the owning side of a bidirectional association specifies the
Expand Down Expand Up @@ -576,7 +677,7 @@ you need to use the following, explicit syntax:
## XML Mapping Driver

The 'inheritance-type' attribute changed to take last bit of ClassMetadata constant names, i.e.
NONE, SINGLE_TABLE, INHERITANCE_TYPE_JOINED
NONE, SINGLE_TABLE, JOINED

## YAML Mapping Driver

Expand Down Expand Up @@ -608,6 +709,7 @@ The Collection interface in the Common package has been updated with some missin
that were present only on the default implementation, ArrayCollection. Custom collection
implementations need to be updated to adhere to the updated interface.


# Upgrade from 2.0-ALPHA3 to 2.0-ALPHA4

## CLI Controller changes
Expand Down Expand Up @@ -644,6 +746,8 @@ With new required method AbstractTask::buildDocumentation, its implementation de
database schema without deleting any unused tables, sequences or foreign keys.
* Use "doctrine schema-tool --complete-update" to do a full incremental update of
your schema.


# Upgrade from 2.0-ALPHA2 to 2.0-ALPHA3

This section details the changes made to Doctrine 2.0-ALPHA3 to make it easier for you
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@
],
"minimum-stability": "dev",
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.0",
"ext-pdo": "*",
"doctrine/collections": "~1.2",
"doctrine/dbal": ">=2.5-dev,<2.7-dev",
"doctrine/dbal": "dev-develop as 3.x-dev",
"doctrine/instantiator": "~1.0.1",
"doctrine/common": "^2.7.1",
"doctrine/cache": "~1.4",
"symfony/console": "~2.5|~3.0"
},
"require-dev": {
"symfony/yaml": "~2.3|~3.0",
"phpunit/phpunit": "^5.4"
},
"suggest": {
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
"phpunit/phpunit": "^5.4",
"phpbench/phpbench": "^0.11.2"
},
"autoload": {
"psr-4": { "Doctrine\\ORM\\": "lib/Doctrine/ORM" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Tests\\": "tests/Doctrine/Tests" }
"psr-4": {
"Doctrine\\Tests\\": "tests/Doctrine/Tests",
"Doctrine\\Performance\\": "tests/Doctrine/Performance"
}
},
"bin": ["bin/doctrine"],
"extra": {
Expand Down
9 changes: 6 additions & 3 deletions docs/en/cookbook/sql-table-prefixes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ appropriate autoloaders.
<?php

namespace DoctrineExtensions;
use \Doctrine\ORM\Event\LoadClassMetadataEventArgs;

use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping;

class TablePrefix
{
Expand All @@ -40,12 +42,13 @@ appropriate autoloaders.
{
$classMetadata = $eventArgs->getClassMetadata();

if (!$classMetadata->isInheritanceTypeSingleTable() || $classMetadata->getName() === $classMetadata->rootEntityName) {
if ($classMetadata->inheritanceType !== Mapping\InheritanceType::SINGLE_TABLE ||
$classMetadata->getName() === $classMetadata->rootEntityName) {
$classMetadata->setTableName($this->prefix . $classMetadata->getTableName());
}

foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) {
if ($mapping['type'] == Mapping\ClassMetadata::MANY_TO_MANY && $mapping['isOwningSide']) {
$mappedTableName = $mapping['joinTable']['name'];
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/dql-doctrine-query-language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ can mark a many-to-one or one-to-one association as fetched temporarily to batch

<?php
$query = $em->createQuery("SELECT u FROM MyProject\User u");
$query->setFetchMode("MyProject\User", "address", \Doctrine\ORM\Mapping\ClassMetadata::FETCH_EAGER);
$query->setFetchMode("MyProject\User", "address", \Doctrine\ORM\Mapping\FetchMode::EAGER);
$query->execute();

Given that there are 10 users and corresponding addresses in the database the executed queries will look something like:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ Load ClassMetadata Event
------------------------

When the mapping information for an entity is read, it is populated
in to a ``ClassMetadataInfo`` instance. You can hook in to this
in to a ``ClassMetadata`` instance. You can hook in to this
process and manipulate the instance.

.. code-block:: php
Expand Down
21 changes: 9 additions & 12 deletions docs/en/reference/metadata-drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ implements the ``Driver`` interface:
<?php
namespace Doctrine\ORM\Mapping\Driver;

use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\ClassMetadata;

interface Driver
{
/**
* Loads the metadata for the specified class into the provided container.
*
* @param string $className
* @param ClassMetadataInfo $metadata
* @param ClassMetadata $metadata
*/
function loadMetadataForClass($className, ClassMetadataInfo $metadata);
function loadMetadataForClass($className, ClassMetadata $metadata);

/**
* Gets the names of all mapped classes known to this driver.
Expand Down Expand Up @@ -107,11 +107,11 @@ the ``AbstractFileDriver`` implementation for you to extend from:
/**
* {@inheritdoc}
*/
public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$data = $this->_loadMappingFile($file);

// populate ClassMetadataInfo instance from $data
// populate ClassMetadata instance from $data
}

/**
Expand Down Expand Up @@ -154,14 +154,11 @@ entity when needed.

You have all the methods you need to manually specify the mapping
information instead of using some mapping file to populate it from.
The base ``ClassMetadataInfo`` class is responsible for only data
storage and is not meant for runtime use. It does not require that
the class actually exists yet so it is useful for describing some
The ``ClassMetadata`` class is responsible for only data storage
and is not meant for runtime use. It does not require that the
class actually exists yet so it is useful for describing some
entity before it exists and using that information to generate for
example the entities themselves. The class ``ClassMetadata``
extends ``ClassMetadataInfo`` and adds some functionality required
for runtime usage and requires that the PHP class is present and
can be autoloaded.
example the entities themselves.

You can read more about the API of the ``ClassMetadata`` classes in
the PHP Mapping chapter.
Expand Down
Loading