title: How to validate a price (money amount) mySql decimal column in Yii?
body: <p>I am using a mySql <strong>DECIMAL(12,4)</strong> column to hold price values (seeing how that's what Magento uses). I want to <a href="http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules" rel="nofollow">validate</a> them in my ActiveRecord model using Yii's <a href="http://www.yiiframework.com/doc/api/1.1/CValidator" rel="nofollow">CValidator</a> rules, but I'm not quite sure how to do it. </p>
  
  <p>I assume I can do it with the <a href="http://www.yiiframework.com/doc/api/1.1/CTypeValidator" rel="nofollow">CTypeValidator</a> set to "float", but I wanted to see how other folks are doing this. I don't see an actual "currency" validator. Maybe I should just validate the length?</p>
  
  <pre><code>array('price', 'type', 'type'=&gt;'float'),
  </code></pre>
  
  <p>or</p>
  
  <pre><code>array('price', 'length', 'max'=&gt;17), // 12 + 4 + . = 17?
  </code></pre>
  
  <p>Suggestions and examples? Thanks!</p>