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

Doctrine\Common metadata drivers reuse #314

Merged
merged 22 commits into from
Jul 4, 2012

Conversation

Ocramius
Copy link
Member

This PR is strictly related with doctrine/common#98, doctrine/common#131 and doctrine/common#150 and tests won't pass until the doctrine-common submodule points to a merged version of it (will do so later, so please don't merge now ).

Basically, I just stripped any code duplicate of what already available in dcom master under Doctrine\Common\Persistence\Mapping\Driver.

Tests are OK on my environment when using the new commons submodule.

(This is a cleanup for #263, where I sadly did pull from the remote branch after rebasing)

Build Status

@stof
Copy link
Member

stof commented Mar 30, 2012

@Ocramius the PR in common has been merged so you can update the submodule to make travis happy

@Ocramius
Copy link
Member Author

Purrrrrrrrrrrrrrrfect, will do :)
Thank you!

@Ocramius
Copy link
Member Author

Build is passing. Time to get this merged. Please let me know if there is more that should be handled in here.

@@ -52,7 +52,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not extend AbstractClassMetadataFactory? This gets rid of most the code!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I started working on this PR you told me this would happen somewhen later.. I can include that anyway :)

@Ocramius
Copy link
Member Author

Ocramius commented Apr 7, 2012

Build is not really broken, travis halted somehow on one of the environments...

*/
protected function doLoadMetadata($class, $parent, $rootEntityFound)
{
throw new \LogicException(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to introduce this dirty fix because of

These steps cannot be reproduced within doLoadMetadata with the given parameters, and patching Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory didn't work either...
Ideas?

@asm89
Copy link
Member

asm89 commented May 4, 2012

@Ocramius Can you rebase (and perhaps squash?) the PR?

@beberlei @guilhermeblanco Can you look at it? I think it's a nice internal refactoring to make it in 2.3. Common is already up to date for this.

@Ocramius
Copy link
Member Author

Ocramius commented May 4, 2012

@asm89 I can do, didn't yet find a decent solution for #314 (comment) though.

@travisbot
Copy link

This pull request fails (merged 305e865f into b32bb26).

@Ocramius
Copy link
Member Author

@asm89 rebased, but the PR Still needs doctrine/common#131 and some code could be removed with doctrine/common#138
Still some failures though.

@Ocramius
Copy link
Member Author

Failures seem to be completely unrelated with the modified code (maybe because I'm using latest doctrine/common master):

Time: 26 seconds, Memory: 357.75Mb

There was 1 error:

1) Doctrine\Tests\ORM\Functional\QueryCacheTest::testQueryCache_HitDoesNotSaveParserResult
Exception: [PHPUnit_Framework_Error] Object of class Mock_ParserResult_1b2988e1 could not be converted to string

With queries:

Trace:
/home/ocramius/Desktop/doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/Cache/CacheProvider.php:143
/home/ocramius/Desktop/doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/Cache/CacheProvider.php:73
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/Query.php:217
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/Query.php:241
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/AbstractQuery.php:737
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/AbstractQuery.php:539
/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php:148


/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/OrmFunctionalTestCase.php:402

--


There were 4 failures:

1) Doctrine\Tests\ORM\Functional\QueryCacheTest::testQueryCache_DependsOnHints
Failed asserting that 2 matches expected 1.

/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php:47

2) Doctrine\Tests\ORM\Functional\QueryCacheTest::testQueryCache_NoHitSaveParserResult
Expectation failed for method name is equal to <string:doSave> when invoked at sequence index 1
Parameter 1 for invocation Doctrine\Common\Cache\ArrayCache::doSave('DoctrineNamespaceCacheKey[]', 1, 0) does not match expected value.
Failed asserting that 1 is an instance of class "Doctrine\ORM\Query\ParserResult".

/home/ocramius/Desktop/doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/Cache/CacheProvider.php:173
/home/ocramius/Desktop/doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/Cache/CacheProvider.php:141
/home/ocramius/Desktop/doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/Cache/CacheProvider.php:73
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/Query.php:217
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/Query.php:241
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/AbstractQuery.php:737
/home/ocramius/Desktop/doctrine2/lib/Doctrine/ORM/AbstractQuery.php:539
/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php:118

3) Doctrine\Tests\ORM\Functional\ResultCacheTest::testNativeQueryResultCaching
Failed asserting that 2 matches expected 1.

/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php:146

4) Doctrine\Tests\ORM\Functional\SQLFilterTest::testQueryCache_DependsOnFilters
Failed asserting that 2 matches expected 1.

/home/ocramius/Desktop/doctrine2/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php:304

FAILURES!
Tests: 1675, Assertions: 5588, Failures: 4, Errors: 1, Skipped: 52.

@beberlei
Copy link
Member

Have you rebased to latest master?

@Ocramius
Copy link
Member Author

@beberlei yep. Will give it a spin when at home again, but I'm pretty sure everything was based on latest master(s) (common/orm)

@travisbot
Copy link

This pull request passes (merged b5446d9c into 7b75849).

@travisbot
Copy link

This pull request passes (merged 6dbb1539 into 7b75849).

/**
* @param EntityManager $$em
* @param EntityManager $em
* @return void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove the @return void here

@Ocramius
Copy link
Member Author

@stof thx for stoffing it, I'm fixing asap :)

@travisbot
Copy link

This pull request passes (merged 6f13b38d into 7b75849).

@Ocramius
Copy link
Member Author

@beberlei @guilhermeblanco @asm89 This can be merged

@travisbot
Copy link

This pull request fails (merged b0759c64 into 9aabdba).

@beberlei
Copy link
Member

Does this break DoctrineBundle with references to drivers? If yes then we should prepare a commit for thta, otherwise i like it very much and +1 for merg enow

* @param ClassMetadataInfo $metadata
* @param ClassMetadata $metadata
* @throws MappingException
* @return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove this empty @return if the method does not return anything, and fix it otherwise

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix later today, but at least this is done :)

@stof
Copy link
Member

stof commented Jun 21, 2012

I think it should work properly in DoctrineBundle as the classes have not changed (only the parent classes have been moved, and the methods are the same)

@travisbot
Copy link

This pull request fails (merged 0c177c75 into 9aabdba).

@Ocramius
Copy link
Member Author

@guilhermeblanco rebased

@travisbot
Copy link

This pull request fails (merged 027d6189 into cc29f85).

SimplifiedXmlDriver and SimplifiedYamlDriver are still not valid after this commit
Interface has been moved to Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
Interface has been moved to Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
Those exceptions are now in the Common\Persistence\Mapping namespace
@travisbot
Copy link

This pull request fails (merged 379e698 into f20a95f).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants