-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from koriym/input
@inputvalidation annotated method throw exception when validation failed
- Loading branch information
Showing
17 changed files
with
142 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ build | |
vendor/ | ||
composer.phar | ||
composer.lock | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* This file is part of the Ray.WebFormModule package | ||
* | ||
* @license http://opensource.org/licenses/MIT MIT | ||
*/ | ||
namespace Ray\WebFormModule\Annotation; | ||
|
||
/** | ||
* @Annotation | ||
* @Target("METHOD") | ||
*/ | ||
class AbstractValidation | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $form = 'form'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* This file is part of the Ray.WebFormModule package | ||
* | ||
* @license http://opensource.org/licenses/MIT MIT | ||
*/ | ||
namespace Ray\WebFormModule\Annotation; | ||
|
||
/** | ||
* @Annotation | ||
* @Target("METHOD") | ||
*/ | ||
final class InputValidation extends AbstractValidation | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* This file is part of the Ray.WebFormModule package | ||
* | ||
* @license http://opensource.org/licenses/bsd-license.php BSD | ||
*/ | ||
namespace Ray\WebFormModule; | ||
|
||
use Doctrine\Common\Annotations\Reader; | ||
use Ray\Di\Di\Named; | ||
|
||
class InputValidationInterceptor extends AuraInputInterceptor | ||
{ | ||
/** | ||
* @var FailureHandlerInterface | ||
*/ | ||
protected $failureHandler; | ||
|
||
/** | ||
* @param Reader $reader Annotation reader | ||
* | ||
* @Named("handler=vnd_error") | ||
*/ | ||
public function __construct(Reader $reader, FailureHandlerInterface $handler) | ||
{ | ||
$this->reader = $reader; | ||
$this->failureHandler = $handler; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Ray\WebFormModule; | ||
|
||
use Ray\Di\Di\Inject; | ||
use Ray\Di\Di\Named; | ||
use Ray\WebFormModule\Annotation\InputValidation; | ||
|
||
class FakeInputValidationController | ||
{ | ||
/** | ||
* @var FormInterface | ||
*/ | ||
protected $form1; | ||
|
||
/** | ||
* @Inject | ||
* @Named("contact_form") | ||
*/ | ||
public function setForm(FormInterface $form) | ||
{ | ||
$this->form1 = $form; | ||
} | ||
|
||
/** | ||
* @InputValidation(form="form1") | ||
*/ | ||
public function createAction($name) | ||
{ | ||
} | ||
} |