Skip to content

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Aug 30, 2023

Apply arg name change from laravel/framework#18380 and param types from laravel/framework#31252

@GromNaN GromNaN requested review from alcaeus and jmikola August 30, 2023 14:50
@GromNaN GromNaN added this to the 4.0.0 milestone Aug 30, 2023
* @param string $foreignKey
* @param string $relation
* @return \MongoDB\Laravel\Relations\EmbedsMany
* @param class-string $related
Copy link
Member

Choose a reason for hiding this comment

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

use Illuminate\Database\Eloquent\Concerns\HasRelationships;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Support\Str;
use MongoDB\Laravel\Eloquent\Model as MongoDBModel;
Copy link
Member

Choose a reason for hiding this comment

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

Was this necessary? We're not referencing another Model class in this file and I don't recall seeing an alias used elsewhere (in previous PRs).

Copy link
Member Author

Choose a reason for hiding this comment

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

My idea was that it's more explicit that we need a MongoDB Model and not the Eloquent Base Model.

Copy link
Member

Choose a reason for hiding this comment

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

Got it. No argument if this was done for readability 👍

* @param string $relation
* @param class-string $related
* @param string|null $foreignKey
* @param string|null $ownerKey
Copy link
Member

Choose a reason for hiding this comment

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

Is the variable change here done for consistency with a base Laravel class/trait?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes and for correctness.

* @param class-string $related
* @param string|null $collection
* @param string|null $foreignPivotKey
* @param string|null $relatedPivotKey
Copy link
Member

Choose a reason for hiding this comment

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

$relatedPivotKey sounds much more descriptive than $otherKey. 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the first motivation. I didn't understand the meaning of all this parameters.

@GromNaN GromNaN requested a review from jmikola August 31, 2023 09:46
@GromNaN GromNaN merged commit 9d36d17 into mongodb:master Aug 31, 2023
@GromNaN GromNaN deleted the relation-clean branch August 31, 2023 19:32
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.

2 participants