123), * array('contact_id' => 456), * )); * * // Compute tokens one row at a time. * foreach ($event->getRows() as $row) { * $row->setTokens('contact', array( * 'profileUrl' => CRM_Utils_System::url('civicrm/profile/view', 'reset=1&gid=456&id=' . $row['contact_id']'), * )); * } * * // Compute tokens with a bulk lookup. * $ids = implode(',', array_filter(CRM_Utils_Array::collect('contact_id', $event->getRows()), 'is_numeric')); * $dao = CRM_Core_DAO::executeQuery("SELECT contact_id, foo, bar FROM foobar WHERE contact_id in ($ids)"); * while ($dao->fetch) { * $row->setTokens('oddball', array( * 'foo' => $dao->foo, * 'bar' => $dao->bar, * )); * } * @encode * */ class TokenValueEvent extends TokenEvent { /** * @return \Traversable */ public function getRows() { return $this->tokenProcessor->getRows(); } }