propel-validator
[ class tree: propel-validator ] [ index: propel-validator ] [ all elements ]

Source for file MaxLengthValidator.php

Documentation is available at MaxLengthValidator.php

  1. <?php
  2. /*
  3.  *  $Id: MaxLengthValidator.php 521 2007-01-05 13:29:36Z heltem $
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the LGPL. For more information please see
  19.  * <http://propel.phpdb.org>.
  20.  */
  21.  
  22. /**
  23.  * A validator for maximum string length.
  24.  *
  25.  * Below is an example usage for your Propel xml schema file.
  26.  *
  27.  * Note that if you have specified the size attribute in the column tag
  28.  * you do not have to specify it as value in the validator rule again as
  29.  * this is done automatically.
  30.  *
  31.  * <code>
  32.  *   <column name="username" type="VARCHAR" size="25" required="true" />
  33.  *
  34.  *   <validator column="username">
  35.  *     <rule name="maxLength" message="Passwort must be at least ${value} characters !" />
  36.  *   </validator>
  37.  * </code>
  38.  *
  39.  * @author     Michael Aichler <aichler@mediacluster.de>
  40.  * @version    $Revision: 521 $
  41.  * @package    propel.validator
  42.  */
  43. class MaxLengthValidator implements BasicValidator
  44. {
  45.  
  46.   public function isValid (ValidatorMap $map$str)
  47.   {
  48.     return strlen($str<= intval($map->getValue());
  49.   }
  50. }

Documentation generated on Thu, 22 Nov 2007 03:33:44 +0000 by phpDocumentor 1.4.0