Parable ORM 0.7.0
Pre-release
Pre-release
0.7.0
Changes
- Time for more type casting! By implementing
HasTypedProperties
and the functiongetPropertyType(string $property): ?int
, you can optionally allow value type casting from and to the database. Supported types are defined onPropertyTypeDeterminer
asTYPE_INT
,TYPE_DATE
,TYPE_TIME
andTYPE_DATETIME
. The last three will return aDateTimeImmutable
instance. The formats ofDATE_SQL
,DATE_TIME
,DATETIME_SQL
are forced for these.- These are cast TO these types after retrieving from the database. This allows, for example, type hinting the setter for created at:
setCreatedAt(DateTimeImmutable $createdAt)
and the getter:getCreatedAt(): DateTimeImmutable
. - These are transformed back to string values before saving, because
toArray()
does so.
- These are cast TO these types after retrieving from the database. This allows, for example, type hinting the setter for created at:
PropertyTypeDeterminer
offers two static methods (typeProperty
anduntypeProperty
) which will attempt to type, if required, the passed property and value on the entity.- New instances of entities are now built using the DI Container. This allows DI to be used in entities if you so wish.