#1022: Introduce new validation report query API
-------------------------+--------------------------------------------------
 Reporter:  david        |       Owner:  david     
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  1.0       
Component:  validation   |     Version:  1.0.0beta8
 Severity:  normal       |    Keywords:            
Has_patch:  0            |  
-------------------------+--------------------------------------------------
 #785 introduced a couple of refactorings to the validation system, and
 also new API parts for getting results out of the validation system, most
 notably via the new classes {{{AgaviValidationArgumentResult}}} and
 {{{AgaviValidationValidatorResult}}}.

 These need to go, because Dominik had a much better idea this week :)

 A new API for convenient querying of indicents, errors and result codes.

 Examples of sweetness:
 {{{
 #!php
 <?php

 $report = $this->getContainer()->getReport();
 // or $report = $this->getContainer()->getReport()->createQuery();

 $nameValid = !$report->byArgument('name')->has();
 $nameMissing =
 $report->byArgument('name')->byErrorName('required')->has();

 $myoptionalfileIsImage = $report->byArgument(new
 AgaviValidationArgument('myoptionalfile',
 AgaviWebRequestDataHolder::SOURCE_FILES))->byValidator('is_image')->getResult()
 === AgaviValidator::SUCCESS;
 }}}

-- 
Ticket URL: <http://trac.agavi.org/ticket/1022>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to