public function getRules() { return array('kg' => array('rate' => function ($value, $to) { if ($to == 'gram') { return $value * 1000; } return $value / 1000; }), 'gram' => array('rate' => function ($value) { return $value; })); }