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

#5934 - add fetch option to AssociationOverride in order to override fetch strategy for subclasses of entities #5938

Merged
merged 3 commits into from
May 31, 2017
Merged

#5934 - add fetch option to AssociationOverride in order to override fetch strategy for subclasses of entities #5938

merged 3 commits into from
May 31, 2017

Conversation

Ma27
Copy link
Contributor

@Ma27 Ma27 commented Jul 16, 2016

adds the fetch option to the association-override sequence.

see #5934

<generator strategy="AUTO" />
</id>

<many-to-many target-entity="DDC5934Member" inversed-by="contract" fetch="LAZY" field="members" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a typo here? Should this be contracts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

possibly. Some tests are still failing. Try to fix it somehow in the next days...

Copy link
Contributor Author

@Ma27 Ma27 Aug 16, 2016

Choose a reason for hiding this comment

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

no, not a typo ;)

@Ma27
Copy link
Contributor Author

Ma27 commented Aug 16, 2016

ok, fixed the tests now and squashed everything into a single commit

@Ocramius anything to add here?

@patrick-mcdougle
Copy link
Contributor

Looks good to me! LGTM!

@patrick-mcdougle
Copy link
Contributor

Sad that this didn't make the release. Anything else to do for this one @Ocramius?

@Ocramius
Copy link
Member

Patch releases don't get new features, folks!

On 11 Sep 2016 5:05 a.m., "Patrick McDougle" notifications@github.com
wrote:

Sad that this didn't make the release. Anything else to do for this one
@Ocramius https://github.com/Ocramius?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#5938 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakJo4yXGsBgmhgwM87OAaoksnct0bks5qo2_6gaJpZM4JN-7o
.

@Ma27
Copy link
Contributor Author

Ma27 commented Sep 11, 2016

http://semver.org/ - the release yesterday was a release which shouldn't contain anything which is a new feature (and this one is definitly a new feature)

@patrick-mcdougle
Copy link
Contributor

Can we get this in 3.0?

@Ma27
Copy link
Contributor Author

Ma27 commented Nov 23, 2016

@patrick-mcdougle we'll see, 2.6 hopefully :-)

@koemeet
Copy link

koemeet commented May 30, 2017

Any news on this?

…ide fetch strategy for subclasses of entities
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

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

I've rebased it to sync with master, made a tiny change (to use ::class syntax) and it LGTM

@lcobucci lcobucci self-assigned this May 30, 2017
@lcobucci lcobucci added this to the 2.6.0 milestone May 30, 2017
@lcobucci lcobucci requested a review from Ocramius May 30, 2017 16:30
@Ma27
Copy link
Contributor Author

Ma27 commented May 30, 2017 via email

@@ -621,6 +621,11 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
$override['inversedBy'] = (string) $overrideElement->{'inversed-by'}['name'];
}

// Check for `fetch`
if (isset($overrideElement['fetch'])) {
$override['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $overrideElement['fetch']);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use ::class for the first bit of the string?

@@ -470,6 +470,11 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
$override['inversedBy'] = $associationOverride->inversedBy;
}

// Check for `fetch`
if ($associationOverride->fetch) {
$override['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $associationOverride->fetch);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use ::class for the first bit of the string?

@@ -622,6 +622,11 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
$override['inversedBy'] = (string) $associationOverrideElement['inversedBy'];
}

// Check for `fetch`
if (isset($associationOverrideElement['fetch'])) {
$override['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $associationOverrideElement['fetch']);
Copy link
Member

Choose a reason for hiding this comment

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

Can we use ::class for the first bit of the string?

@Ma27
Copy link
Contributor Author

Ma27 commented May 31, 2017 via email

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -472,7 +472,7 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)

// Check for `fetch`
if ($associationOverride->fetch) {
$override['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $associationOverride->fetch);
$override['fetch'] = constant(ClassMetadata::class . '::FETCH_' . $associationOverride->fetch);
Copy link
Member

Choose a reason for hiding this comment

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

This won't work since ClassMetadata points to Doctrine\Common\Persistence\Mapping\ClassMetadata and it doesn't have the constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ouch, I'm sorry^^

Copy link
Member

Choose a reason for hiding this comment

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

ARGH, good catch :S

@Ma27
Copy link
Contributor Author

Ma27 commented May 31, 2017

@lcobucci as travis-ci seems to not run on this PR, I just executed the corresponding tests on my machine:

→ ./vendor/bin/phpunit --group DDC-5934
PHPUnit 6.2-g3e3c42c32 by Sebastian Bergmann and contributors.

......                                                              6 / 6 (100%)

Time: 1.01 seconds, Memory: 36.00MB

OK (6 tests, 12 assertions)

@Ocramius
Copy link
Member

@Ma27 travis passed! 👍

@Ocramius Ocramius merged commit 22ecc2d into doctrine:master May 31, 2017
@Ma27 Ma27 deleted the feature/DDC5934-allow-fetch-override branch May 31, 2017 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants