How to get User id in Shell


#1

I am saving records to the database from a shell and I need to set current user id before save.
Or should I call a controller action?


#2

You’ll need to pass the user id into the shell as a parameter. Shells aren’t run in a “request”, or authenticated context and so have no concept of users.