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

DOC Document using raw SQL to query join tables #508

Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented May 10, 2024

Adds detail about how to query columns on join tables if the field name conflicts with field names from other tables in the query.

Issue

use SilverStripe\ORM\DataObject;

$rankingColumn = DataObject::getSchema()->sqlColumnForField(TeamSupporter::class, 'Ranking');
$team = Team::get()->byId(1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$team = Team::get()->byId(1);
$team = Team::get()->byID(1);

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@GuySartorelli GuySartorelli force-pushed the pulls/5.2/raw-sql-for-joins branch from ec14520 to 0902297 Compare May 13, 2024 21:59
@emteknetnz emteknetnz merged commit d10e763 into silverstripe:5.2 May 13, 2024
3 checks passed
@emteknetnz emteknetnz deleted the pulls/5.2/raw-sql-for-joins branch May 13, 2024 22:53
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