Documentation MyBrickStore

TranslationModel extends Model
in package

Class TranslationModel

  • Manages the retrieval of localized text strings from the database
  • Supports dynamic switching between languages (e.g., fr/en)

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.
getTranslations()  : array<string|int, mixed>
Retrieves all translation pairs for a specific language
requete()  : PDOStatement|false
Executes a SQL query (prepared or direct).

Properties

$table

protected string $table

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.

getTranslations()

Retrieves all translation pairs for a specific language

public getTranslations(string $lang) : array<string|int, mixed>
Parameters
$lang : string

the language code (e.g., 'fr', 'en')

Return values
array<string|int, mixed>

associative array where keys are text identifiers

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.


        
On this page

Search results