definition: |
manyToOneGetRelated :: String -> Entity -> [String] -> [Entity] -> [Relationship] -> [CFuncDecl] manyToOneGetRelated erdname (Entity entityName _) entities _ relationships = map getRelatedFunction entities where getRelatedFunction :: String -> CFuncDecl getRelatedFunction foreignEntity = let argvar = (1, (take 1 $ lowerFirst entityName) ++ foreignEntity) rname = fst (relationshipName entityName foreignEntity relationships) fkeysel = lowerFirst entityName ++ foreignEntity ++ rname ++ "Key" in stCmtFunc ("Gets the associated " ++ foreignEntity ++ " entity for a given "++ entityName ++ " entity.") (controllerModuleName entityName, "get" ++ rname ++ foreignEntity) 0 Private ((ctvar entityName) ~> applyTC (dbconn "DBAction") [ctvar foreignEntity]) [simpleRule [CPVar argvar] (applyF (model erdname,"get" ++ foreignEntity) [applyF (model erdname,fkeysel) [CVar argvar]])] |
demand: |
arguments 2 3 |
deterministic: |
deterministic operation |
failfree: |
<FAILING> |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,{Entity},_,_,_) |-> {:,[]}} |
name: |
manyToOneGetRelated |
precedence: |
no precedence defined |
result-values: |
{:,[]} |
signature: |
String -> Database.ERD.Entity -> [String] -> [Database.ERD.Entity] -> [Database.ERD.Relationship] -> [AbstractCurry.Types.CFuncDecl] |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |