Skip to content

Commit

Permalink
add filter for input form
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Feb 6, 2013
1 parent 3523b9e commit bec76f7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/default.php
Expand Up @@ -67,6 +67,11 @@
*/
$di->setter['Aura\Framework\Cli\Server\Command']['setSystem'] = $di->lazyGet('framework_system');

/**
* Aura\Framework\Cli\Server\Command
*/
$di->setter['Aura\Framework\Input\Form']['setFilter'] = $di->lazyNew('Aura\Filter\RuleCollection');

/**
* Aura\Framework\View\Helper\AssetHref
*/
Expand Down
1 change: 1 addition & 0 deletions src.php
Expand Up @@ -10,6 +10,7 @@
require_once __DIR__ . '/src/Aura/Framework/Exception.php';
require_once __DIR__ . '/src/Aura/Framework/Exception/NoClassForController.php';
require_once __DIR__ . '/src/Aura/Framework/Inflect.php';
require_once __DIR__ . '/src/Aura/Framework/Input/Form.php';
require_once __DIR__ . '/src/Aura/Framework/Intl/Translator.php';
require_once __DIR__ . '/src/Aura/Framework/Intl/TranslatorFactory.php';
require_once __DIR__ . '/src/Aura/Framework/Signal/Manager.php';
Expand Down
35 changes: 35 additions & 0 deletions src/Aura/Framework/Input/Form.php
@@ -0,0 +1,35 @@
<?php
namespace Aura\Framework\Input;

use Aura\Filter\RuleCollection;
use Aura\Input\Form as InputForm;

class Form extends InputForm
{
protected $filter;

public function setFilter(RuleCollection $filter)
{
$this->filter = $filter;
$this->initFilter();
}

protected function initFilter()
{
}

public function getFilter()
{
return $this->filter;
}

public function filter()

This comment has been minimized.

Copy link
@harikt

harikt Feb 7, 2013

Member

@pmjones wondering whether it is a good idea to make it as isValid() . That means to check the form is valid or not. I understand you will say it has not just validation , but there is filtering also. But isValid sounds much better .

{
return $this->filter->values($this->values);
}

public function getMessages()
{
return $this->filter->getMessages();
}
}
1 change: 1 addition & 0 deletions tests/WiringTest.php
Expand Up @@ -28,6 +28,7 @@ public function testInstances()
$this->assertNewInstance('Aura\Framework\Cli\CacheConfig\Command');
$this->assertNewInstance('Aura\Framework\Cli\Factory');
$this->assertNewInstance('Aura\Framework\Cli\Server\Command');
$this->assertNewInstance('Aura\Framework\Input\Form');
$this->assertNewInstance('Aura\Framework\View\Helper\AssetHref');
$this->assertNewInstance('Aura\Framework\View\Helper\Route');
$this->assertNewInstance('Aura\Framework\Web\Asset\Page');
Expand Down

0 comments on commit bec76f7

Please sign in to comment.