codeconsole commented on code in PR #15070:
URL: https://github.com/apache/grails-core/pull/15070#discussion_r2353115967


##########
grails-scaffolding/src/main/groovy/grails/plugin/scaffolding/GormService.groovy:
##########
@@ -46,19 +46,15 @@ class GormService<T extends GormEntity<T>> {
         resourceName = GrailsNameUtils.getPropertyName(resource)
     }
 
-    protected T queryForResource(Serializable id) {
-        resource.get(id)
-    }
-
     T get(Serializable id) {
-        queryForResource(id)
+        resource.get(id)
     }
 
     List<T> list(Map args) {
         resource.list(args)
     }
 
-    Long count() {
+    Long count(Map args) {

Review Comment:
   It is meant for overriding.   You can do this:
   
   ```groovy
   @Scaffold(domain = User)
   class UserService {
       List<T> list(Map args) {
           args.firstName? User.findAllByFirstName(args.firstName) : 
User.count()
       }
   
        Long count(Map args) {
              args.firstName? User.countByFirstName(args.firstName) : 
User.count()
        }
   } 
   ```
   
   then in your scaffold controller, you could just hit 
/user/index?firstName=scott with no additional changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@grails.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to