php - Using a custom finder in a custom route class -


this custom route class works, when replace query custom finder returns error: unknown finder method "published". not possible use custom finder here?

class contentsroute extends route {  public function parse($url) {      $params = parent::parse($url);     if (!($params)) {         return false;     }      $pages = cache::read('pages');     if ($pages === false) {         $contents = tableregistry::get('contents');         // custom finder          // $query = $contents->find('published');          $query = $contents->find()             ->select(['id', 'path', 'public'])             ->where(['contents.published' => 1]);          $pages = $query->toarray();           cache::write('pages', $pages);     }      if (isset($pages[$url])) {         $params['pass'] = array('path' => $url);         return $params;     }      return false;      }  }  //contentstable.php public function findpublished(query $query, array $options) {     $query = $this->find()         ->select(['id', 'path', 'public'])         ->where(['contents.published' => 1]);     return $query; } 


Comments