Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Created January 26, 2016 17:23
Show Gist options
  • Save bwaidelich/8769f645ab5f71454d3c to your computer and use it in GitHub Desktop.
Save bwaidelich/8769f645ab5f71454d3c to your computer and use it in GitHub Desktop.
Example for reusable REST/CRUD sub routes (For the Flow application framework)
-
name: 'NewAction'
uriPattern: 'new'
defaults:
'@action': 'new'
httpMethods: [GET]
-
name: 'CreateAction'
uriPattern: 'create'
defaults:
'@action': 'create'
httpMethods: [POST]
-
name: 'UpdateAction'
uriPattern: 'update'
defaults:
'@action': 'update'
httpMethods: [POST,PUT]
-
name: 'EditAction'
uriPattern: '{<entityName>}/edit'
defaults:
'@action': 'edit'
httpMethods: [GET]
-
name: 'DeleteAction'
uriPattern: '{<entityName>}/delete'
defaults:
'@action': 'delete'
httpMethods: [POST,DELETE]
-
name: 'ShowAction'
uriPattern: '{<entityName>}'
defaults:
'@action': 'show'
httpMethods: [GET]
-
name: 'IndexAction'
uriPattern: ''
defaults:
'@action': 'index'
appendExceedingArguments: TRUE
httpMethods: [GET]
##
# Products
-
name: 'Products'
uriPattern: 'products/<CRUDSubRoutes>'
defaults:
'@package': 'Some.Package'
'@controller': 'Product'
'@format': 'html'
routeParts:
'product':
objectType: 'Some\Package\Domain\Model\Product'
subRoutes:
'CRUDSubRoutes':
package: 'Some.Package'
suffix: 'CRUD'
variables:
'entityName': 'product'
@putheakhem
Copy link

great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment