本文整理汇总了PHP中Customers::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::fetchAll方法的具体用法?PHP Customers::fetchAll怎么用?PHP Customers::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customers
的用法示例。
在下文中一共展示了Customers::fetchAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* View a list of all customers
*/
public function indexAction()
{
$customersTable = new Customers();
$this->view->customers = $customersTable->fetchAll();
}
示例2: getNewInvoiceForm
private function getNewInvoiceForm(array $values = null)
{
$customersTable = new Customers();
$customers = $customersTable->fetchAll();
$customerList = array();
if ($customers->count() > 0) {
foreach ($customers as $c) {
$customerList[$c->customer_id] = $c->company;
}
}
$form = new Zend_Form();
$form->setAction('/invoices/save')->setMethod('post');
$customer = new Zend_Form_Element_Select('customer');
$customer->addMultiOptions($customerList)->setLabel('Customer');
$invoiceDate = new Zend_Form_Element_Text('invoice_date');
$invoiceDate->setRequired(true)->setLabel('Invoice Date')->addValidator(new Zend_Validate_Date())->setAttrib('class', 'date')->setValue(date('Y-m-d'));
$dueDate = new Zend_Form_Element_Text('due_date');
$dueDate->setRequired(true)->setLabel('Due Date')->addValidator(new Zend_Validate_Date())->setAttrib('class', 'date')->setValue(date('Y-m-d', strtotime('+1 month')));
$notes = new Zend_Form_Element_Textarea('notes');
$notes->setLabel('Notes');
$submit = new Zend_Form_Element_Submit('submit');
if (isset($values)) {
$customer->setValue($values['customer_id']);
$invoiceDate->setValue($values['invoice_date']);
$dueDate->setValue($values['due_date']);
$notes->setValue($values['notes']);
}
$form->addElement($customer)->addElement($invoiceDate)->addElement($dueDate)->addElement($notes)->addElement($submit);
return $form;
}