select(['id', 'username', 'password']); if (!empty($options['return_created'])) { $query->select(['created']); } return $query; } /** * Custom finder * * @param \Cake\ORM\Query $query The query to find with * @param array $options The options to find with * @return \Cake\ORM\Query The query builder */ public function findUsername(Query $query, array $options) { if (empty($options['username'])) { throw new Exception(__('Username not defined')); } $query = $this->find() ->where(['username' => $options['username']]) ->select(['id', 'username', 'password']); return $query; } }