Documentation MyBrickStore

CommandeModel extends Model
in package

Class CommandeModel

  • Manages order data and status updates
  • Handles retrieval of order details, history, and invoice information

Table of Contents

Properties

$table  : string

Methods

find()  : mixed
Finds a specific record by its ID.
findAll()  : array<string|int, mixed>|false
Retrieves all records from the associated table.
getCommandeById()  : object|false
Retrieves a single order by its identifier
getCommandeByUserId()  : array<string|int, mixed>
Fetches the order history for a logged-in user
getCommandeStatusById()  : string
Fetches the current status of an order
getOrderDetails()  : array<string|int, mixed>|false
Retrieves comprehensive order details including invoice and customer info
requete()  : PDOStatement|false
Executes a SQL query (prepared or direct).
updateStatus()  : bool
Updates the status of a specific order

Properties

$table

protected string $table = 'CustomerOrder'

The database table associated with the model.

Methods

find()

Finds a specific record by its ID.

public find(int $id) : mixed
Parameters
$id : int

The record identifier.

Return values
mixed

The record object or false if not found.

findAll()

Retrieves all records from the associated table.

public findAll() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

List of records.

getCommandeById()

Retrieves a single order by its identifier

public getCommandeById(int $id) : object|false
Parameters
$id : int
Return values
object|false

getCommandeByUserId()

Fetches the order history for a logged-in user

public getCommandeByUserId(int $userId) : array<string|int, mixed>
Parameters
$userId : int
Return values
array<string|int, mixed>

list of order objects

getCommandeStatusById()

Fetches the current status of an order

public getCommandeStatusById(int $id) : string
Parameters
$id : int
Return values
string

status or 'inconnu'

getOrderDetails()

Retrieves comprehensive order details including invoice and customer info

public getOrderDetails(int $orderId) : array<string|int, mixed>|false
Parameters
$orderId : int
Return values
array<string|int, mixed>|false

associative array of order details

requete()

Executes a SQL query (prepared or direct).

public requete(string $sql[, array<string|int, mixed>|null $attributs = null ]) : PDOStatement|false
Parameters
$sql : string

The SQL query string.

$attributs : array<string|int, mixed>|null = null

Optional parameters for prepared statements.

Return values
PDOStatement|false

The result statement.

updateStatus()

Updates the status of a specific order

public updateStatus(int $id, string $status) : bool
Parameters
$id : int

order identifier

$status : string

new status string

Return values
bool

true on success


        
On this page

Search results