And we're back to no casting whatsoever. 0.5.0 was intended to be a first step to more complete type casting for values, but it became clear the functionality wasn't going where it needed to go.
So, placing the responsibility back at the implementation where I now believe it lies. The other improvements from 0.5.0 have been kept, however.
Major change
This update contains a handy change. The TypeCaster
has been added. This will attempt to cast SQL-standard dates, times and datetimes to DateTimeImmutable
objects, leaving everything else as string
.
See TypeCasterTest
for the test cases. In case there are scenarios in which the parsing does not go correctly, please open an issue or PR to add the scenario to the test cases.
It's possible to disable the TypeCaster
by calling TypeCaster::disable()
before doing any database retrievals. Enabling it again can be done by calling TypeCaster::enable()
.
Changes
Database::DATE_SQL
andDatabase::TIME_SQL
have been added.setCreatedAt()
andsetUpdatedAt()
have been removed from the feature interfaces. This leaves only the mark methods left, and leaves the implementation up to you.
Changes
-
AbstractRepository
did not fail gracefully when instanced without a validDatabase
instance available in the DI Container. An active Database connection is not, however, required to instantiate a repository. It is, however, to use it. Now instantiating is possible, but attempting to use the repository will fail.See
testCreateRepositorySuccessfulWithoutDatabaseButFailsOnPerformingAnything
for specifics. Also, I'm super good at naming tests.
Changes
-
Database
has gained multiple getters to make it easier to work with. -
AbstractRepository
now useshasValueSets()
rather thancountValueSets() > 0
. -
Obsolete soft quoting setting removed, as it was never implemented here. Quoting is done in the
parable-php/query
package. -
Implemented
__debugInfo()
onDatabase
to prevent the password being leaked while being dumped.NOTE: This cannot prevent
var_export
usage. It is strongly suggested not to usevar_export
for logging purposes where an instance ofDatabase
may be logged.
Changes
-
Updated to
parable-php/query
0.2.1, which offersOrderBy::asc(...$keys)
andOrderBy::desc(...$keys)
, rather than using strings.Example usage:
$repository->findAll(OrderBy::asc('id');
.
Changes
- Entities will no longer attempt to set values on new instances that are already
null
. This makes it possible to more strictly type setters. - Repositories gained a method:
findUniqueBy($callable): AbstractEntity
. It returns null on 0, the entity on 1 and throws on 1+.
Same as 0.1.2 but now without breaking changes in a major pre-release version.
Changes
Revert previous changes since the directory rename actually required a 0.2.0.
Changes
- Renamed
Traits
directory toFeatures
since they haven't been traits for a while. - Removed
getCreatedAt()
andgetUpdatedAt()
from theSupportsSomethingedAt
features, since Parable ORM doesn't require them and you should choose how to expose them.
Changes
- Remove some debug stuff.
Changes
- First release.