Zone
extends Entity
in package
Uses
WithDatabase
Content zone class
A zone is a physical place, independent of the location. This mechanism allows to more easily move zones.
This class maps the content_zones table.
Table of Contents
Properties
Methods
- __construct() : mixed
- Initializes a new instance of a zone object
- assign_to() : mixed
- Assigns the zone at the specified location.
- at() : Zone
- Gets the zone at specified location
- getDatabase() : DatabaseEngine
- load_from_database() : bool
- Loads the object zone (ie fill the properties) from the database
- load_from_form() : mixed
- Loads the object zone (ie fill the properties) from the $_POST array
- load_from_row() : mixed
- Loads the object zone (ie fill the properties) from the $row array
- save_to_database() : void
- Saves the object to the database
- search() : array<string|int, Zone>
- Gets all the zones matching the specified location queries
- setDatabase() : void
Properties
$deleted
public
mixed
$deleted
= false
$id
public
mixed
$id
$params
public
mixed
$params
$title
public
mixed
$title
$type
public
mixed
$type
$db
private
DatabaseEngine
$db
Methods
__construct()
Initializes a new instance of a zone object
public
__construct(DatabaseEngine $db[, int $id = '' ]) : mixed
Parameters
- $db : DatabaseEngine
- $id : int = ''
-
The zone ID
assign_to()
Assigns the zone at the specified location.
public
assign_to(string $location_global, mixed $location_local[, bool $delete_old_locations = true ]) : mixed
Parameters
- $location_global : string
-
the local location
- $location_local : mixed
- $delete_old_locations : bool = true
-
if true, delete old locations
at()
Gets the zone at specified location
public
static at(DatabaseEngine $db, string $location_global, string $location_local[, bool $create = false ]) : Zone
Parameters
- $db : DatabaseEngine
- $location_global : string
-
the global location
- $location_local : string
-
the local location
- $create : bool = false
-
if the zone doesn't exist, create it [optional] [default value: false]
Return values
Zone —the zone, or null if the zone doesn't exist and $create is false
getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEngineload_from_database()
Loads the object zone (ie fill the properties) from the database
public
load_from_database() : bool
Return values
boolload_from_form()
Loads the object zone (ie fill the properties) from the $_POST array
public
load_from_form() : mixed
load_from_row()
Loads the object zone (ie fill the properties) from the $row array
public
load_from_row(mixed $row) : mixed
Parameters
- $row : mixed
save_to_database()
Saves the object to the database
public
save_to_database() : void
search()
Gets all the zones matching the specified location queries
public
static search(DatabaseEngine $db, string $location_global_query, string $location_local_query[, mixed $use_regexp_for_local = false ]) : array<string|int, Zone>
Parameters
- $db : DatabaseEngine
- $location_global_query : string
-
the global location query
- $location_local_query : string
-
the local location query
- $use_regexp_for_local : mixed = false
Return values
array<string|int, Zone> —[SECURITY] They are passed as is in SQL [R]LIKE queries, you can't inject users expression.
The following properties are added to the Zone items of the returned array:
- location_global
- location_local
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine