Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry-packages
spicey
Commits
4695354f
Commit
4695354f
authored
Jan 25, 2018
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix in controller code generation for entities with several many-to-many relationships
parent
c5ae0e38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
src/Spicey/ControllerGeneration.curry
src/Spicey/ControllerGeneration.curry
+14
-8
No files found.
src/Spicey/ControllerGeneration.curry
View file @
4695354f
...
...
@@ -207,10 +207,9 @@ createTransaction erdname (Entity entityName attrList) relationships allEntities
(zip (parameterList ++ map lowerFirst manyToOneEntities ++
map (\e -> (lowerFirst e) ++ "s") manyToManyEntities)
[1..]))
] -- parameterlist for controller
(applyF (dbconn ">+")
[foldr1 (\a b -> applyF (dbconn ">+=") [a,b])
([applyF (entityConstructorFunction erdname (Entity entityName attrList) relationships)
] -- parameter list for controller
(applyF (dbconn ">+=")
[applyF (entityConstructorFunction erdname (Entity entityName attrList) relationships)
(map (\ ((Attribute name dom key null), varId) ->
if (isForeignKey (Attribute name dom key null))
then applyF (erdname, (lowerFirst (getReferencedEntityName dom))++"Key")
...
...
@@ -221,10 +220,17 @@ createTransaction erdname (Entity entityName attrList) relationships allEntities
then applyF (pre "Just") [cv]
else cv)
(zip noPKeys [1..])
)
] ++ (map (\name -> applyF (controllerModuleName entityName, "add"++(linkTableName entityName name allEntities)) [cvar ((lowerFirst name)++"s")]) manyToManyEntities)
),
applyF (pre "return") [constF (pre "()")]]
),
CLambda [cpvar "newentity"]
(foldr1 (\a b -> applyF (dbconn ">+") [a,b])
(map (\name -> applyF (controllerModuleName entityName,
"add"++(linkTableName entityName name allEntities))
[cvar (lowerFirst name ++ "s"),
cvar "newentity"])
manyToManyEntities ++
[applyF (pre "return") [constF (pre "()")]])
)
]
)]
editController :: ControllerGenerator
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment