SilverCommerce\OrdersAdmin\Factory\OrderFactory
Synopsis
class OrderFactory
{
- // members
- private static string $estimate_class = Estimate::class;
- private static string $invoice_class = Invoice::class;
- private static string $order_ref_param = "Ref";
- protected bool $is_invoice;
- protected Estimate $order;
- protected $ref;
- protected $id;
- // methods
- public OrderFactory __construct()
- public OrderFactory findOrMake()
- public OrderFactory addItem()
- public OrderFactory addFromLineItemFactory()
- public OrderFactory updateItem()
- public OrderFactory removeItem()
- public OrderFactory setCustomer()
- public OrderFactory write()
- public OrderFactory delete()
- public Estimate getOrder()
- protected SS_List getItems()
- public boolean getIsInvoice()
- public OrderFactory setIsInvoice()
- public int getRef()
- public OrderFactory setRef()
- public int getId()
- public OrderFactory setId()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\Core\Config\Configurable
Members
private
- $estimate_class
—
string
The class this factory uses to create an estimate - $invoice_class
—
string
The class this factory uses to create an order - $order_ref_param
—
string
Parameter on estimates/invoices that is used as a "Reference number"
protected
- $id
—
int
The estimate/invoice ID (if null, a new estimate/invoice is created) - $is_invoice
—
SilverCommerce\OrdersAdmin\Factory\bool
Are we working with an invoice or an estimate? - $order
—
\SilverCommerce\OrdersAdmin\Model\Estimate
An instance of an Invoice/Estimate - $ref
—
int
The reference number for the invoice (if null, a new invoice is created)
Methods
protected
- getItems() — Get the current Invoice/Estimate items list
public
- __construct() — Create a new instance of the factory and setup the estimate/invoice
- addFromLineItemFactory() — Add a new item to the current Estimate/Invoice from a pre-created line item factory
- addItem() — Add a line item to the current order based on the provided product
- delete() — Delete the current Estimate/Invoice from the DB
- findOrMake() — Attempt to either find an existing order, or make a new one.
- getId() — Get the estimate/invoice ID (if null, a new estimate/invoice is created)
- getIsInvoice() — Get are we working with an invoice or an estimate?
- getOrder() — Get an instance of an Invoice/Estimate
- getRef() — Get the reference number for the invoice (if null, a new invoice is created)
- removeItem() — Remove a line item from the current order based on the provided key
- setCustomer() — Add the provided customer to the Invoice/Estimate
- setId() — Set the estimate/invoice ID (if null, a new estimate/invoice is created)
- setIsInvoice() — Set are we working with an invoice or an estimate?
- setRef() — Set the reference number for the invoice (if null, a new invoice is created)
- updateItem() — Update the quantity of a line item from the current order based on the provided key
- write() — Write the currently selected order