OrderRepositoryWriter
in package
implements
OrderRepositoryWriterInterface
Class OrderRepositoryWriter
Tags
Interfaces, Classes and Traits
- OrderRepositoryWriterInterface
- Interface OrderRepositoryWriterInterface
Table of Contents
- $db : CI_DB_query_builder
- Query builder.
- __construct() : mixed
- OrderRepositoryWriter constructor
- insert() : int
- Inserts a new order to the orders table.
- update() : OrderRepositoryWriter
- Updates an existing order in the orders table.
- _serializeAddressBlock() : array<string|int, mixed>
- Serializes address block.
- _serializeOrder() : array<string|int, mixed>
- Converts the order to an associative array that is later used to insert/update the values into the database.
Properties
$db
Query builder.
protected
CI_DB_query_builder
$db
Methods
__construct()
OrderRepositoryWriter constructor
public
__construct(CI_DB_query_builder $db) : mixed
Parameters
- $db : CI_DB_query_builder
-
Query builder.
Return values
mixed —insert()
Inserts a new order to the orders table.
public
insert(OrderInterface $order) : int
Parameters
- $order : OrderInterface
-
Order.
Return values
int —ID of inserted order.
update()
Updates an existing order in the orders table.
public
update(OrderInterface $order) : OrderRepositoryWriter
Parameters
- $order : OrderInterface
-
Order object.
Return values
OrderRepositoryWriter —Same instance for method chaining.
_serializeAddressBlock()
Serializes address block.
protected
_serializeAddressBlock(AddressBlockInterface $addressBlock, StringType $prefix) : array<string|int, mixed>
Parameters
- $addressBlock : AddressBlockInterface
-
The object to be serialized.
- $prefix : StringType
-
The address prefix can be one of the "delivery", "billing" and "customers".
Return values
array<string|int, mixed> —Array with the address data.
_serializeOrder()
Converts the order to an associative array that is later used to insert/update the values into the database.
protected
_serializeOrder(OrderInterface $order) : array<string|int, mixed>
Parameters
- $order : OrderInterface
-
The object to be serialized.
Return values
array<string|int, mixed> —Contains the orders object matched with their respective db columns.