If your blog is more of a reference than a diary, why do you organise your posts in a timeline? Instead group them by category. #

July 24, 2015 at 10:22 AM in Status

My entry for the Danny Darko – Hurricane ft Julien Kelland remix contest is now available on SoundCloud: https://soundcloud.com/freefalling/hurricane-freefall-remix Feedback welcome! #

July 23, 2015 at 3:33 PM in Status

Let’s all turn off on-site commenting, and allow replies via moderated trackback. Anyone can start a blog and participate with increased civility and ownership. DONE. #

July 23, 2015 at 10:22 AM in Status

Enum label lookup

In your datamodel you might have a Enum field such as this date-based dropdown:

public static $db = array(
    "Year"        => "Enum('2013, 2014, 2015')"
}

Internally, SilverStripe stores the index, so that when you retrieve the value in methods such as onBeforeWrite, instead of 2013 you will receive 1. Use the function below to retrieve the label of the Enum:

public function EnumLabel($field_name) {
    $enumValues = $this->dbObject($field_name)->enumValues();
    $label    = $enumValues[$this->$field_name];
    return $label;
}

// $year = $this->EnumLabel('Year');

July 23, 2015 at 10:08 AM in SilverStripe

LessThanOrEqual in SilverStripe 3.0

When adding a filter on a DataList sometimes you need to do a <= rather than a <. Unfortunately the LessThanOrEqual and GreatherThanOrEqual search filters do not exist in SilverStripe 3.0.x, they were added in 3.1.

Therefore we have to write our own where clause like the following example:

// Return all the sessions on or before the $date
$sessions = new DataList('AcademicSession');
$sessions = $sessions->where('"SessionStartDate" <= \'' . $date . '\'');

July 23, 2015 at 10:11 AM in SilverStripe

#iosstorymode “the best of the year of high quality of life and the other hand is the only thing that would have to go back.” #

July 16, 2015 at 7:05 AM in Status

#iosstorymode Open a new note, enter the first word, then keep pressing the text suggestions button and see what stream of consciousness erupts. #

July 16, 2015 at 7:59 AM in Status