This release reorganizes the code substantially. The global state which was
littered all over the project (DB, Conf, Event) is now consolidated in one
place, the central Phormium\Orm class.
New features:
QuerySets are now iterable - this will fetch rows one by one instead of fetching all at once.- Column and table names are properly quoted in SQL as expected by each database - double quotes for most and backticks for MySQL.
This causes several breaks to backward compatibility:
- Requires PHP 5.6
DBclass is deprecated in favour ofOrm::database()Eventclass is deprecated in favour ofOrm::emitter()Confclass has been removed, useOrm::configure()- Made
Printermethods non-static - Made
ColumnFilter,RawFilterandCompositeFilterimmutable.CompositeFilter::add()no longer exists because it mutated the filter, and has been replaced withCompositeFilter::withAdded()which returns a newCompositeFilterinstance.- Made
ColumnFilter,RawFilterandCompositeFilterproperties private, available via getter methods which are named the same as the properties, e.g.ColumnFilter::value()
- Renamed existing
CompositeFilteraccessor methods:CompositeFilter::getOperation()->CompositeFilter::operation()CompositeFilter::getFilters()->CompositeFilter::filters()
- Several changes to
Aggregate- Moved to
Phormium\Querynamespace - Made properties private, available via getter methods.
- Moved to
Deprecated methods will emit a deprecation warning when used and will be removed in the next release.
Bug fixes:
- Fix:
Connection->execute()should return the number of affected rows (#12) - Fix: Apply limit and offset to distinct queries (#18)
- Fix: Fix handling of boolean
false(#24)
- Added database attributes to configuration
- BC BREAK: Phormium will no longer force lowercase column names on
database tables. This can still be done manually by setting the
PDO::ATTR_CASE:attribute toPDO::CASE_LOWERin the configuration.
- BC BREAK: Dropped support for PHP 5.3
- Added a shorthand for model relations with
Model->hasChildren()andModel->hasParent()
- Fixed an issue with shallow cloning which caused the same Filter instance to be used in cloned QuerySets.
- Added
DB::disconnect(), for disconnecting a single connection - Added
DB::isConnected(), for checking if a connection is up - Added
DB::setConnection(), useful for mocking - Added
Connection->inTransaction()
-
BC BREAK: Moved filter classes to
Phormium\Filternamespace
Please update your references (e.g.use Phormium\ColumnFiltertouse Phormium\Filter\ColumnFilter). -
BC BREAK: Removed logging and stats classes
These will be reimplemented using events and available as separate packages. -
Added
Model::all() -
Added
Model->toYAML() -
Added
Model::fromYAML() -
Added raw filters
-
Added events
-
Modified
Model::fromJSON()to take an optional$strictparameter
- Added
Model->dump() - Added
Filter::col() - Added gathering of query stats
- Added support for custom queries via
Connectionobject - Added
Model->merge() - Added
Model::find() - Added
Model::exists() - Modified
Model::get()to accept the primary key as an array - Modified
Model->save()to be safer
- Added
QuerySet::valuesFlat() - Added optional parameter
$allowEmptytoQuerySet->single()
- Added transactions
- Added
QuerySet->dump() - Added logging via Apache log4php
- Added composite filters
- Initial release