root/trunk/lib/validator/sfValidatorSchemaLicence.class.php

Revision 79, 0.6 kB (checked in by nperriault, 1 month ago)

[1.1] Updated functional tests, migrated Job form

Line 
1 <?php
2 /**
3  * This validators validates the license and is_opensource fields
4  *
5  */
6 class sfValidatorSchemaLicence extends sfValidatorSchema
7 {
8   /**
9    * Apply validation
10    *
11    * @param mixed $values
12    */
13   protected function doClean($values)
14   {
15     if ($values['is_opensource'] && 0 === strlen(trim($values['licence'])))
16     {
17       $error = new sfValidatorError($this, 'If your application is open source, you must specify the license (MIT, BSD, GPL, etc.)');
18       throw new sfValidatorErrorSchema($this, array('licence' => $error));
19     }
20
21     return $values;
22   }
23 }
24
Note: See TracBrowser for help on using the browser.