transform(new MyTransformation()); * @package forms * @subpackage transformations */ class FormTransformation extends Object { public function transform(FormField $field) { // Look for a performXXTransformation() method on the field itself. // performReadonlyTransformation() is a pretty commonly applied method. // Otherwise, look for a transformXXXField() method on this object. // This is more commonly done in custom transformations // We iterate through each array simultaneously, looking at [0] of both, then [1] of both. // This provides a more natural failover scheme. $transNames = array_reverse(array_values(ClassInfo::ancestry($this->class))); $fieldClasses = array_reverse(array_values(ClassInfo::ancestry($field->class))); $len = max(sizeof($transNames), sizeof($fieldClasses)); for($i=0;$i<$len;$i++) { // This is lets fieldClasses be longer than transNames if($transName = $transNames[$i]) { if($field->hasMethod('perform' . $transName)) { $funcName = 'perform' . $transName; //echo "