Cake\ORM\Table::hasFinder PHP Method

hasFinder() public method

Returns true if the finder exists for the table
public hasFinder ( string $type ) : boolean
$type string name of finder to check
return boolean
    public function hasFinder($type)
    {
        $finder = 'find' . $type;
        return method_exists($this, $finder) || $this->_behaviors && $this->_behaviors->hasFinder($type);
    }

Usage Example

 /**
  * Processes the records.
  *
  * @param \Cake\ORM\Table $table
  * @param int $chunkCount
  * @param int $chunkSize
  * @return void
  */
 protected function _process(Table $table, $chunkCount, $chunkSize)
 {
     $query = $table->find();
     if ($table->hasFinder('purifier')) {
         $query->find('purifier');
     }
     $fields = explode(',', $this->param('fields'));
     $fields[] = $table->primaryKey();
     $results = $query->select($fields)->offset($chunkCount)->limit($chunkSize)->orderDesc($table->aliasField($table->primaryKey()))->all();
     if (empty($results)) {
         return;
     }
     foreach ($results as $result) {
         try {
             $table->save($result);
             $chunkCount++;
         } catch (\Exception $e) {
             $this->error($e->getMessage());
         }
     }
 }