From 50b536e2b84f4e9ac2a5dcd6b8ebbbb3b7e56d80 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 6 Aug 2008 03:31:42 +0000 Subject: [PATCH] (merged from branches/roa. use "svn log -c -g " for detailed commit message) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@59922 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DataObject.php | 2 +- core/model/fieldtypes/Year.php | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/core/model/DataObject.php b/core/model/DataObject.php index b8e595e51..bd41e4f4c 100644 --- a/core/model/DataObject.php +++ b/core/model/DataObject.php @@ -1182,7 +1182,7 @@ class DataObject extends ViewableData implements DataObjectInterface { * generate this set. * * - * class MyCustomClass extends DataObject { + * klass MyCustomClass extends DataObject { * static $db = array('CustomProperty'=>'Boolean'); * * public function getCMSFields() { diff --git a/core/model/fieldtypes/Year.php b/core/model/fieldtypes/Year.php index a47e4b8e3..af0b5563e 100644 --- a/core/model/fieldtypes/Year.php +++ b/core/model/fieldtypes/Year.php @@ -1,4 +1,9 @@ tableName, $this->name, "year(4)"); + DB::requireField($this->tableName, $this->name, "year"); } public function scaffoldFormField($title = null) { @@ -17,19 +22,9 @@ class Year extends DBField { return $selectBox; } - /** - * Returns a list of default options that can - * be used to populate a select box, or compare against - * input values. Starts by default at the current year, - * and counts back to 1900. - * - * @param int $start starting date to count down from - * @param int $end end date to count down to - * @return array - */ - private function getDefaultOptions($start=false, $end=false) { - if (!$start) $start = (int)date('Y'); - if (!$end) $end = 1900; + private function getDefaultOptions() { + $start = (int)date('Y'); + $end = 1900; $years = array(); for($i=$start;$i>=$end;$i--) { $years[] = $i;