Ticket #859 (closed defect: fixed)

Opened 16 months ago

Last modified 16 months ago

Notnull validator needs to consider the args.

Reported by: bruno.p.reis Owned by: zYne-
Priority: minor Milestone: 0.10.4
Component: Validators Version: 0.10.0
Severity: Keywords:
Cc: Has Test:
Status: Has Patch:

Description (last modified by bruno.p.reis) (diff)

Since my schema was autogenerated with notnull:false, I think it should be set this way. So the Validator, when called, has to use this parameter do do de validation.

I got mine working with:

/**

 * Doctrine_Validator_Notnull

 *

 * @package     Doctrine

 * @subpackage  Validator

 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL

 * @link        www.phpdoctrine.com

 * @since       1.0

 * @version     $Revision: 2702 $

 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>

 */

class Doctrine_Validator_Notnull extends Doctrine_Validator_Driver

{

    /**

     * checks that given value isn't null

     *

     * @param mixed $value

     * @return boolean

     */

    public function validate($value)

    {

            if ( $this->getArg('args') === true) { 

          return ($value !== null);

            }

            else {

              return true;

            }

    }

}

Change History

Changed 16 months ago by bruno.p.reis

  • description modified (diff)

Changed 16 months ago by romanb

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.