Ticket #1022 (closed enhancement: fixed)

Opened 19 months ago

Last modified 19 months ago

Implement new validation report query API

Reported by: david Owned by: david
Priority: normal Milestone: 1.0
Component: validation Version: 1.0.0beta8
Severity: normal Keywords:
Cc: Patch attached: no

Description (last modified by david) (diff)

#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

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

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

// every by() method returns a clone of the query object, so we do not have to make new instances here
$nameMissing = $report->byArgument('name')->byErrorName('required')->has();

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

Attachments

1022-test.patch Download (2.5 KB) - added by david 19 months ago.
Quick and dirty sample app mods to use this API

Change History

Changed 19 months ago by david

(In [3781]) branching off 1.0 for working on a new validation report query API, refs #1022

Changed 19 months ago by david

(In [3782]) initial work based on a patch by dominik, refs #1022

Changed 19 months ago by david

Quick and dirty sample app mods to use this API

Changed 19 months ago by david

(In [3792]) add not processes arguments to the argumentresults instead of ignoring them

Changed 19 months ago by david

(In [3793])

  • rename getArgumentResults to getArguments
  • implement getResult to return the "proper" validation result in all cases

Changed 19 months ago by david

  • status changed from new to assigned

Changed 19 months ago by david

  • description modified (diff)

Changed 19 months ago by david

(In [3794]) Removed AgaviValidationArgumentResult? and AgaviValidationValidatorResult? and associated APIs. Changed AgaviValidationReport::getResult() to return null if no result code exists at all (= no validators defined), and adjusted AgaviValidationManager::getReport() to remain backwards compatible (continues to return NOT_PROCESSED in this case) Fixed AgaviReport::addIncident() Fixed AgaviReport::getAuthoritativeArgumentSeverity() Adjusted FPF to use new API. Cleaned up docs Refs #1022

Changed 19 months ago by david

  • summary changed from Introduce new validation report query API to Implement new validation report query API

Changed 19 months ago by david

(In [3796]) changelog and release notes for this awesomeness, refs #1022

Changed 19 months ago by david

  • status changed from assigned to closed
  • resolution set to fixed

(In [3800]) merging in validation-report-query branch, closes #1022 and #1030. Check it out, folks!

Changed 19 months ago by david

(In [3810]) added AgaviIValidationReportQuery::byMaxSeverity(), cleaned up the docs and fixed an issue with minSeverity filter checks in AgaviValidationReportQuery::getResult(), refs #1022

Add/Change #1022 (Implement new validation report query API)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.