Skip to content

Laravel: Use Model::qualifyColumn() instead of $table.$column#6658

Merged
soyuka merged 1 commit into
api-platform:4.0from
GromNaN:laravel-qualify
Sep 23, 2024
Merged

Laravel: Use Model::qualifyColumn() instead of $table.$column#6658
soyuka merged 1 commit into
api-platform:4.0from
GromNaN:laravel-qualify

Conversation

@GromNaN
Copy link
Copy Markdown
Contributor

@GromNaN GromNaN commented Sep 21, 2024

Q A
Branch? 4.0
Tickets -
License MIT
Doc PR -

The function Model::qualifyColumn() does exactly the same as the existing code. But for MongoDB, we had to override this method as the column name (field name) cannot be prefixed with the table name (collection name). So we need this method to be used instead of having the logic hard coded.

For relations, we use the getQualifiedForeignKeyName that has the same mechanism for BelongsTo and HasOneOrManyThrough , but nothing for HasOneOrMany (I don't know why 😞).

@soyuka soyuka merged commit a6e3706 into api-platform:4.0 Sep 23, 2024
@soyuka
Copy link
Copy Markdown
Member

soyuka commented Sep 23, 2024

Awesome thanks @GromNaN ! It's possible that within some filters we're using the same mechanics. With Doctrine we had to duplicate each filter, maybe that with Eloquent we can use the exact same filters?

@GromNaN GromNaN deleted the laravel-qualify branch September 23, 2024 12:58
@GromNaN
Copy link
Copy Markdown
Contributor Author

GromNaN commented Sep 23, 2024

It's possible that within some filters we're using the same mechanics. With Doctrine we had to duplicate each filter, maybe that with Eloquent we can use the exact same filters?

I haven't found any other place where the column name is prefixed.

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