ufront / ufront-orm

The Object Relational Mapper, allows easy, type-safe access to your database. Builds on Haxe's SPOD but adds macro powered relationships, validation and client side usage
MIT License
13 stars 4 forks source link

PHP Mysql test, post1.validationErrors has duplicate error message #17

Closed theRemix closed 9 years ago

theRemix commented 9 years ago

In PHP Mysql test, post1.validationErrors has duplicate error added
{text => [You cannot have an empty blog post,You cannot have an empty blog post]}

is this due to your comment in DBMacros.hx:209-217 ?

// The field can pre-exist for two reasons:
// There are multiple @:validate metadata, and this is not the first.
// There is @:validate metadata AND a validate_$field() function.
// If it's the latter, and we're using the compilation server, there's a chance we already added this line.
//                          var metaID = ':${p.file}_${p.min}_${p.max}';
//                          alreadyAdded = f.meta.exists(function(m) return m.name==metaID);
//                          if ( !alreadyAdded )
//                              f.meta.push({ name:metaID, params:[], pos:meta.pos });
                            // Unfortunately... I can't figure out the best way to solve this problem.

test result is this.

Test PHP mysql

assertations: 158
successes: 157
errors: 0
failures: 1
warnings: 0
execution time: 1.615
script time: 2.605

results: SOME TESTS FAILURES (success: false)
testcases.TestValidation
  testValidateFieldFunction: FAILURE ..F....
    line: 116, expected "You cannot have an empty blog post" but was "You cannot have an empty blog post
You cannot have an empty blog post"

i don't know of a proper fix, though i gave it a shot. see my related pull request.