# CMS Tutorial findBySlug not found

**URL:** <https://discourse.cakephp.org/t/cms-tutorial-findbyslug-not-found/5462>\
**Category:** Need Help\
**Created:** [December 27, 2018, 5:17am UTC](https://discourse.cakephp.org/t/cms-tutorial-findbyslug-not-found/5462 "2018-12-27T05:17:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill\_s](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@bill\_s](https://discourse.cakephp.org/u/bill_s)\
**Post date:** [December 27, 2018, 5:17am UTC](https://discourse.cakephp.org/t/cms-tutorial-findbyslug-not-found/5462/1 "2018-12-27T05:17:09Z")

</div>

In the CMS tutorial the has a call to findBySlug like the following in the ArticlesController.php file:

```
    public function view($slug)
{
    $article = $this->Articles->findBySlug($slug)->firstOrFail();
    $this->set(compact('article'));
}

```

My ide, PhpStorm, highlights the function and says it is not found in “\App\Model\Table\ArticlesTable”.  
What am I missing?

---

<div class="post-metadata">

**Author:** ![Graziel](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Graziel](https://discourse.cakephp.org/u/Graziel)\
**Post date:** [December 27, 2018, 5:23am UTC](https://discourse.cakephp.org/t/cms-tutorial-findbyslug-not-found/5462/2 "2018-12-27T05:23:43Z")

</div>

you dont miss anything its called using magic `__call` function

> <https://github.com/cakephp/cakephp/blob/c60a9590422f9fb44a45467bccdc5f6c7601f533/src/ORM/Table.php#L2505>

you can hint your IDE by adding docBlock before table class declaration:

```auto
/**
 * @method \Cake\ORM\Query findBySlug(string $slug)
 */

```

---

<div class="post-metadata">

**Author:** ![bill\_s](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@bill\_s](https://discourse.cakephp.org/u/bill_s)\
**Post date:** [December 27, 2018, 5:38am UTC](https://discourse.cakephp.org/t/cms-tutorial-findbyslug-not-found/5462/3 "2018-12-27T05:38:05Z")

</div>

Thanks Graziel, that worked.
