Let’s say you log events into a database table Log. Attribute event holds event type and you want to filter the log listing just by that.
Here’s what you probably try at first:
-
-
$this->set(‘events’‘list’‘fields’ => ‘DISTINCT Log.event’, ‘Log.event’)));
-
It’s not gonna work and you will have to use find(‘all’) and Set::combine() to get what you want:
-
span class=”st0″>’all’‘fields’ => ‘DISTINCT Log.event’));
-
$this->set(‘events’,
-
Set::combine($events, ‘{n}.Log.event’, ‘{n}.Log.event’));
-