/** * Get voucher types * * @return array * An array of arrays as follows: array( array('label'=>$name0, 'value'=>$id0), array('label'=>$name1, 'value'=>$id1),…) */ public function getVoucherTypes() { $voucherTypes = array(); $this->VoucherType->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function ($VoucherType) use(&$voucherTypes) { array_push($voucherTypes, array('label' => $this->Lang->has($VoucherType->lang_key) ? $this->Lang->get($VoucherType->lang_key) : $VoucherType->name, 'value' => $VoucherType->id)); }); return $voucherTypes; }