controllerで呼び出す条件を制御

<?php

// /marunouchis/index

namespace App\Controller;

class MarunouchisController extends AppController
{
	public function index()
	{
		// $marunouchis = $this->Marunouchis->find('all');
		$marunouchis = $this->Marunouchis->find('all')
			->order(['id' => 'DESC']);
		$this->set(compact('marunouchis'));
	}
}
?>

idの降順で呼び出します。

idが5以上のデータを呼び出す
-> paramに条件を指定

class MarunouchisController extends AppController
{	

	public function index()
	{
		// $marunouchis = $this->Marunouchis->find('all');
		$params = array(
		    'conditions' => array(
		        'id >' => 5,
		    ),
		);
		$marunouchis = $this->Marunouchis->find('all', $params);
		$this->set(compact('marunouchis'));
	}
}