Inside controller’s index action, I’m trying to select articles that were written by the current logged in user. $articles = $this->Articles->find()->where([ ‘user_id’ => $this->request ->getAttribute(‘identity’)->getIdentifier(); ]);
But having 'Unknown method “where” ’ error.
Are you sure the error is happening on this line of code? Because it looks fine. What does debug(get_class($this->Articles)) give you?
debug(get_class($this->Articles))
Thank you, it is working now. I spelled wher instead of where.
This is why it’s always best to copy your code and error messages directly and paste them here, instead of retyping them.