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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

how to choose a golf club?


Go to End


2 Posts   1183 Views

Avatar
ajshort

Community Member, 244 Posts

22 October 2008 at 8:32pm

Edited: 22/10/2008 8:33pm

Hey there,

In order to determine a suitable club, you first need to create your club object, and define a one to one between you and your Clubs - as everyone knows that each club chooses a different owner.

class Club extends DataObject {
	public static $db = array(
		'Type' => 'Enum('Putter, Other', 'Putter')'
	);
}

Then, you need to decorate your member:

class ClubDecorator extends DataObjectDecorator {
	public function extraDBFields() {
		return array (
			'has_one' => array('Club' => 'Club')
		);
	}
}

Once you have dont this, you can then do a simple

Member::currentUser()->Club

to find a club.

BTW: if your going to spam you may as well use a correct link :P

Avatar
Fuzz10

Community Member, 791 Posts

24 October 2008 at 2:55am

Wahahaha..

Rofl..

Good one ! ;-)