Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
Done more refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Abou-Aichi committed May 22, 2016
1 parent 553b711 commit d988449
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/entitiescreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,18 @@ function extractField(field) {
}

function setRelationshipOfEntity(classId) {
var associations = getRelatedAssociations(
var relatedAssociations = getRelatedAssociations(
classId,
parsedData.associations);
for (let i = 0; i < associations.from.length; i++) {
setSourceAssociationsForClass(relatedAssociations, classId);
setDestinationAssociationsForClass(relatedAssociations, classId);
}

function setSourceAssociationsForClass(relatedAssociations, classId) {
for (let i = 0; i < relatedAssociations.from.length; i++) {
let otherSplitField;
let splitField;
let association = parsedData.getAssociation(associations.from[i]);
let association = parsedData.getAssociation(relatedAssociations.from[i]);
checkValidityOfAssociation(
association,
parsedData.getClass(association.from).name,
Expand Down Expand Up @@ -342,10 +347,13 @@ function setRelationshipOfEntity(classId) {
}
entities[classId].relationships.push(relationship);
}
for (let i = 0; i < associations.to.length; i++) {
}

function setDestinationAssociationsForClass(relatedAssociations, classId) {
for (let i = 0; i < relatedAssociations.to.length; i++) {
let splitField;
let otherSplitField;
let association = parsedData.getAssociation(associations.to[i]);
let association = parsedData.getAssociation(relatedAssociations.to[i]);
let relationship = {
relationshipType: (association.type === cardinalities.ONE_TO_MANY ? cardinalities.MANY_TO_ONE : association.type)
};
Expand Down

0 comments on commit d988449

Please sign in to comment.