QueryObject
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
Constructor for the QueryObject class.
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.
Magic setter method to dynamically set properties, this method sets the value of $name if it is a valid property.
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.
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.
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.
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.