Permalink
Browse files

feat(validator): Add validation rule for associations to validator

  • Loading branch information...
RWOverdijk committed Dec 21, 2015
1 parent 350c9e3 commit 30fb1dd1918d561c8ac2a99708af962224824c9e
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/index.js
@@ -1,8 +1,11 @@
import {EntityManager} from './entity-manager';
import {ValidationGroup} from 'aurelia-validation';
import {HasAssociationValidationRule} from './validator/has-association';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
export {OrmMetadata} from './orm-metadata';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
@@ -14,4 +17,8 @@ export function configure(aurelia, configCallback) {
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
ValidationGroup.prototype.hasAssociation = function() {
return this.isNotEmpty().passesRule(new HasAssociationValidationRule());
};
}

0 comments on commit 30fb1dd

Please sign in to comment.