Query in cakephp 3

I need help, I have a problem when I want to make a sql request in cakephp 3.2 here is the request in my model class:

namespace App\Model\Table;

use Cake\ORM\Table;
use Cake\ORM\TableRegistry;

class MarchesTable extends Table
public function initialize(array $config)

public function getMarche()
            $query = TableRegistry::getTableLocator()->get('Marches');
		'nombre' => $query->func()->count('*'),
		'montantCible' => $query->func()->sum('montant_cible'),
		'montantCommande' => $query->func()->sum('montant_commande'),
		'montantRecep' => $query->func()->sum('montant_receptionne'),

	return $query;

and here is the message I get when I debug the result from my controller:

Unknown method “func” BadMethodCallException

someone can tell me why i got this error, thanks

I found the answer, I forgot the find () in $query = TableRegistry::getTableLocator()->get(‘Marches’)->find();

Can you change title to:

[Solved] Query in cakephp