From 7899bea3e585fa0cc2e2c037c3ba38da2ea3d01b Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Mon, 30 Jan 2012 11:10:25 +0100 Subject: [PATCH] Added examples to UPGRADE --- UPGRADE-2.1.md | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index dbd2b3f6b5..a46451ee8e 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -81,9 +81,46 @@ UPGRADE FROM 2.0 to 2.1 * Changed implementation of choice lists ArrayChoiceList was replaced. If you have custom classes that extend - ArrayChoiceList and load the choices in the constructor, you can extend - SimpleChoiceList instead. If choices are loaded lazily, you should extend - LazyChoiceList and implement its `loadChoiceList` method. + this class, you can now extend SimpleChoiceList. + + Before: + + class MyChoiceList extends ArrayChoicList + { + protected function load() + { + parent::load(); + + // load choices + + $this->choices = $choices; + } + } + + After: + + class MyChoiceList extends SimpleChoicList + { + public function __construct() + { + // load choices + + parent::__construct($choices); + } + } + + If you need to load the choices lazily - that is, as soon as they are + accessed for the first time - you can extend LazyChoiceList instead. + + class MyChoiceList extends LazyChoiceList + { + protected function loadChoiceList() + { + // load choices + + return new SimpleChoiceList($choices); + } + } PaddedChoiceList, MonthChoiceList and TimezoneChoiceList were removed. Their functionality was merged into DateType, TimeType and