Validator-Pfad für Zend-Form setzen

Posted in Zend Framework, 10.02.2014 17:02

Validator-Klassen unter /library/Imi/Validate/...



class Application_Form_Codesubmit extends Zend_Form
{

    protected $_productOptions =  array( '' => 'Gekauftes Produkt*');

    public function __construct($options = null)
    {
        parent::__construct($options);
        $this->addElementPrefixPath('Imi_Validate_','Imi/Validate','validate');
        $this->setElementFilters(array('StringTrim', 'StripTags'));
        $this->getElement('captcha')->removeFilter('StringTrim');
        $this->getElement('captcha')->removeFilter('StripTags');
    }

    public function init()
    {
      ....


 

Validator-Klasse z.B.:


<?php

class Imi_Validate_Ibancountry extends Zend_Validate_Abstract
{
   ....