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.

 

Announcing the Winner of the SilverStripe Code Competition

We were thrilled to receive such a strong pool of submissions for our code competition.

Read post

We were thrilled to receive such a strong pool of submissions for our code competition. We ended up in a three-way tie, and it took the judges an extra day to agree on a winner. It was a very difficult decision, but today we are pleased to congratulate Stephan Bauer as the winner of the contest.

Stephan's submission:


// Allows visitors to like each Page once per IP
// Code submitted by relaxt confusion labs
class Page extends SiteTree {

	private static $has_many = array(
		'Likes' => 'Page_Like'
	);

}

class Page_Controller extends ContentController {

	// Enables liking a Page by appending "likethispage" to a Page's url
	private static $allowed_actions = array(
		'likethispage'
	);

	public function likethispage(SS_HTTPRequest $request) {
		$ip = $request->getIP();
		if($this->Likes()->filter('IP', $ip)->Count() == 0) {
			$pageLike = Page_Like::create();
			$pageLike->IP = $ip;
			$this->Likes()->add($pageLike);
		}
		$this->redirectBack();
	}

}

class Page_Like extends DataObject {

	private static $db = array(
		'IP' => 'Varchar(45)'
	);

	private static $has_one = array(
		'LikedPage' => 'Page'
	);

}

Stephan's submission stood out to the judges due to the variety of functionality it demonstrated, including ORM filtering, a custom controller action, and a custom DataObject type. Plus, the code is coherent and functional, and the judges could easily imagine it being used in production. Great work, Stephan!

Due honourable mention are the runners up:

Thanks again for all the submissions. It was a pleasure to see such a great response from the community. We look forward to showcasing Stephan's work on our Software page.

Stephan, we'll be in touch soon to work out arrangements on getting you that drone!

About the author
Aaron Carlino

Aaron Carlino, better known by his whimsical pseudonym Uncle Cheese has been an active member of the SilverStripe community since 2007, and has never looked back. In that time, he has established himself as a support resource, mentor, and contributor of some of the framework's most popular open source modules.

Post your comment

Comments

  • Aw so close! :) congratulations Stephan

    Posted by Jono, 13/08/2015 7:37am (4 years ago)

  • Well drone Stephan :D

    Posted by Otterpocket, 12/08/2015 9:51pm (4 years ago)

RSS feed for comments on this page | RSS feed for all comments

Like what you have read?

Sign up for our weekly blog digest sent to your inbox.

Subscribe