class QueryObject (View source)

The QueryObject class represents a query object used for building and managing database queries. It has an internal storage array ($property) to store query object data and a list of valid properties ($validProperties) that can be used within the class.

Methods:

  • __get($name): mixed: Returns a reference to the property value if it is a valid property, initializes it as an empty array if it doesn't exist, or returns null if it's not a valid property.
  • __set($name, $value): void: Sets the value of a valid property, removes the property from storage if the value is empty, or does nothing if the property is not valid.
  • __isset($name): bool: Returns true if the property exists in the storage array, false otherwise.
  • __debugInfo(): array: Returns the internal storage array for debugging purposes.

Fields:

  • $property: Stores properties for dynamic property access.

Methods

__construct()

Constructor for the QueryObject class.

mixed
__get(string $name)

Magic getter method to access dynamic properties, this method returns a reference to the property specified by $name if it is a valid property. If the property does not exist in the storage, it initializes it as an empty array. If $name is not a valid property, it returns null.

void
__set(string $name, mixed $value)

Magic setter method to dynamically set properties, this method sets the value of $name if it is a valid property.

bool
__isset(string $name)

Magic isset method to check if a dynamic property exists, this method is triggered by calling isset() or empty() on inaccessible (protected or private) or non-existing properties. It returns true if the property exists, false otherwise.

array
__debugInfo()

Magic method for debugging and returns the storage array used for storing the QueryObject properties.

Details

__construct()

Constructor for the QueryObject class.

Initializes a new instance of the QueryObject.

mixed __get(string $name)

Magic getter method to access dynamic properties, this method returns a reference to the property specified by $name if it is a valid property. If the property does not exist in the storage, it initializes it as an empty array. If $name is not a valid property, it returns null.

Parameters

string $name

The name of the property to retrieve.

Return Value

mixed

A reference to the property value if valid, or null if not.

void __set(string $name, mixed $value)

Magic setter method to dynamically set properties, this method sets the value of $name if it is a valid property.

If the value is not empty, it sets the value in the storage, otherwise it removes the property from the storage if it exists.

Parameters

string $name

The name of the property to set.

mixed $value

The value to assign to the property.

Return Value

void

bool __isset(string $name)

Magic isset method to check if a dynamic property exists, this method is triggered by calling isset() or empty() on inaccessible (protected or private) or non-existing properties. It returns true if the property exists, false otherwise.

Parameters

string $name

The name of the property to check.

Return Value

bool

True if the property exists, false otherwise.

array __debugInfo()

Magic method for debugging and returns the storage array used for storing the QueryObject properties.

Return Value

array

The storage array.