You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There needs to be a way of "registering" classes (or namespaces of classes) for the QueryCollection by name. For example, $db->fetch("customer/getById", 123); will return a Row, but if there is a registered class for "Customer" that extends Row it will return that instead.
Pre property type hints:
class Customer extends Row {
/** @var int *//
public $id;
/** @var DateTime **/
public $registered_at;
}
Post property type hints:
class Customer extends Row {
public int $id;
public DateTime $registered_at;
}
For this functionality to work, the properties must be declared within the class - not as docblock comments to the class. This is for future compatibility when we have typed properties.
Update: This functionality can work with DocBlock comments, until typed properties become available! The Reflection API can look at the doc blocks for properties and cast them there.
The text was updated successfully, but these errors were encountered:
We need to implement a type casting system so that
Row
property types are casted automatically as they are fetched from the database.When the typed properties RFC is passed this will be baked into the language, but we can introduce docblock casting already.
There needs to be a way of "registering" classes (or namespaces of classes) for the QueryCollection by name. For example,
$db->fetch("customer/getById", 123);
will return aRow
, but if there is a registered class for "Customer" that extendsRow
it will return that instead.Pre property type hints:
Post property type hints:
For this functionality to work, the properties must be declared within the class - not as docblock comments to the class. This is for future compatibility when we have typed properties.Update: This functionality can work with DocBlock comments, until typed properties become available! The Reflection API can look at the doc blocks for properties and cast them there.
The text was updated successfully, but these errors were encountered: