I am trying to practice the section of Saving BelongsToMany Associations where an example given in the document is to make an association between two existing entities.
I followed below examples in my ArticlesController.php
$this->loadModel('Users');
$article = $this->Articles->get(2);
$user = $this->Users->get(1);
$links = $this->Articles->Users->link($article, [$user]);
debug($links);
Note: I am getting the values correctly from $article and $user Variables
after debugging this, i am getting the errors which is 'Unknown method "link" ' where there is no clue from where the link method comes here in the document.
Thanks in advance for helping & guiding me.