<?php
namespace Moto\Application\Users; use Moto\InputFilter\AbstractInputFilter; use Moto; class SetUserStatusFilter extends AbstractInputFilter { protected $_name = 'users.change:status'; public function init() { $this->add(array( 'name' => 'user_id', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'Digits', 'break_chain_on_failure' => true, ), array( 'name' => 'Db_RecordExists', 'options' => array( 'table' => Moto\Config::get('database.prefix') . 'users', 'field' => 'id', 'adapter' => Moto\Config::get('databaseAdapter') ) ) ), )); $this->add(array( 'name' => 'enabled', 'filters' => array( array('name' => 'Boolean'), array('name' => 'Moto\Filter\IntValue'), ), 'validators' => array( array( 'name' => 'InArray', 'options' => array( 'haystack' => array(0, 1), 'strict' => 1 ) ), ), )); } }