Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
feat(validator): Add validation rule for associations to validator
Browse files Browse the repository at this point in the history
  • Loading branch information
RWOverdijk committed Dec 21, 2015
1 parent 350c9e3 commit 30fb1dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 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';
Expand All @@ -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.