You'll have to share the code for your `User.cfc`....
# box-products
c
You'll have to share the code for your
User.cfc
. I suspect the
get()
method is returning an array, rather than a single user object. And since it's returning an array, the error message is saying that the array doesn't have a
setNotifications
method.
b
@Ookma-Kyi What Carl said. Also, I would encourage you to put some additional effort into trouble shooting on your own. For eaxmple, if there is a variable which you expect to hold an object containing a method, but the error says the variable is an array, you should start by • dumping out the variable to see what's in it • Re-evaluating your expectations of what you expected that variable to have • tracing back the code that creates the variable to see where you went wrong
As Carl pointed out, the error is pretty obvious and self explanatory-- you are trying to call a non-existent method on an array. The answer of "why" or what went wrong is really only something you can answer at this point.
Your screenshot doesn't really show much, but based on the green stripe on the left hand side, I would assume your object is contained WITHIN the array.
Attention to details is important here. Just because the object you expect shows up somewhere on your screen, doesn't mean its the top most object in the data structure
Did you read anything else I said above?
o
Yes i need to include my User model. Also it is returning an array instead of a model. Not sure why it's different this time, since its a copy and paste of my previous code. Going to investigate now.
c
Let us see the User model and maybe we can tell you.
b
it is returning an array instead of a model
Which is exactly what I speculated above.
o
Actually I am assuming it is based on the error.
Late start today, so opening vsc now
Fixed it 🙂