Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Implement new validation report query API #1022

Closed
dzuelke opened this Issue Feb 5, 2009 · 11 comments

Comments

Projects
None yet
1 participant
Contributor

dzuelke commented Feb 5, 2009

  1. 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();

// 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;
```

Contributor

dzuelke commented Feb 5, 2009

(In 69c38a7aa87c1aefaa771eb127e5b4b93e11d269) branching off 1.0 for working on a new validation report query API, refs #1022

Contributor

dzuelke commented Feb 5, 2009

(In 0129cfe2613f7495a9aa3a6e92e3a5363f870a70) initial work based on a patch by dominik, refs #1022

Contributor

dzuelke commented Feb 5, 2009

Attachment: Quick and dirty sample app mods to use this API

https://github.com/agavi/trac-ticket-attachments/blob/master/1022/1022-test.patch (2.5 kB)

Contributor

dzuelke commented Feb 6, 2009

(In 51d255a57c0cecd26da83a17daf49148ec677608) add not processes arguments to the argumentresults instead of ignoring them

Contributor

dzuelke commented Feb 6, 2009

(In 1af57c115b62f71100bfc7686d1e710d30dbfdcc)
- rename getArgumentResults to getArguments
- implement getResult to return the “proper” validation result in all cases

Contributor

dzuelke commented Feb 6, 2009

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

Contributor

dzuelke commented Feb 6, 2009

Title changed from “Introduce new validation report query API” to “Implement new validation report query API”

Contributor

dzuelke commented Feb 6, 2009

(In 388d1bc42428c23823fdf4a1689db1ac7026be3b) changelog and release notes for this awesomeness, refs #1022

Contributor

dzuelke commented Feb 6, 2009

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

Contributor

dzuelke commented Feb 6, 2009

Issue closed

Contributor

dzuelke commented Feb 8, 2009

(In c426a6f78bc33d1ae152b17129177da8fc3b1f13) added AgaviIValidationReportQuery::byMaxSeverity(), cleaned up the docs and fixed an issue with minSeverity filter checks in [AgaviValidationReportQuery](http://github.com/agavi/agavi/wiki/AgaviValidationReportQuery)::getResult(), refs #1022

@ghost ghost assigned dzuelke Jan 16, 2014

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment