Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
A team has many players (or rather, each player has exactly one team).
Each player has exactly one nationality.
Is there a built-in function to easily query all nationalities of one team?
DataObject::get_one('Team', 'Tiny Giants')->Players()->Nationalities();
DataObject::get_one('Team', 'Tiny Giants')->Nationalities(); // this is, BTW, RoR syntax for has_many :through
My suggestion would be function column of DataObjectSet, as in:
DataObject::get_one('Team', 'Tiny Giants')->Players()->column('Nationality'); // returns an array for method or data item 'Nationality'
It is (currently) defined on or about line 675 of file sapphire/core/model/DataObjectSet.php
And if nationalities are DataObjects themselves?