definition: |
destroyController :: ControllerGenerator destroyController erdname (Entity entityName _) _ _ = let entlc = lowerFirst entityName -- entity name in lowercase entvar = (0, entlc) -- entity parameter for controller listEntityURL = '?' : entityName ++ "/list" in controllerFunction ("Deletes a given " ++ entityName ++ " entity\n" ++ "and proceeds with the list controller.") entityName "destroy" 1 (baseType (model erdname, entityName) ~> controllerType) [simpleRule [CPVar entvar] (applyF (pre "$") [applyF checkAuthorizationFunc [applyF (enauthModName,entlc++"OperationAllowed") [applyF (authorizationModule,"DeleteEntity") [CVar entvar]]], CLambda [CPVar (0,"_")] $ applyF (spiceyModule,"transactionController") [applyF (model erdname,"runT") [applyF (transFunctionName entityName "delete") [CVar entvar]], applyF (pre "const") [doExpr [CSExpr $ applyF (spiceyModule,"setPageMessage") [string2ac $ entityName ++ " deleted"], CSExpr $ applyF (spiceyModule,"redirectController") [applyF (spiceyModule,"listRoute") [CVar entvar]]]]]])] |
demand: |
argument 2 |
deterministic: |
deterministic operation |
documentation: |
--- Generates controller to delete an entity. |
failfree: |
(_, _, _, _) |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,{Entity},_,_) |-> _} |
name: |
destroyController |
precedence: |
no precedence defined |
result-values: |
_ |
signature: |
String -> Database.ERD.Entity -> [Database.ERD.Relationship] -> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |