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:
QuerySet
s 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
DB
class is deprecated in favour ofOrm::database()
Event
class is deprecated in favour ofOrm::emitter()
Conf
class has been removed, useOrm::configure()
- Made
Printer
methods non-static - Made
ColumnFilter
,RawFilter
andCompositeFilter
immutable.CompositeFilter::add()
no longer exists because it mutated the filter, and has been replaced withCompositeFilter::withAdded()
which returns a newCompositeFilter
instance.- Made
ColumnFilter
,RawFilter
andCompositeFilter
properties private, available via getter methods which are named the same as the properties, e.g.ColumnFilter::value()
- Renamed existing
CompositeFilter
accessor methods:CompositeFilter::getOperation()
->CompositeFilter::operation()
CompositeFilter::getFilters()
->CompositeFilter::filters()
- Several changes to
Aggregate
- Moved to
Phormium\Query
namespace - 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_LOWER
in 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\Filter
namespace
Please update your references (e.g.use Phormium\ColumnFilter
touse 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$strict
parameter
- Added
Model->dump()
- Added
Filter::col()
- Added gathering of query stats
- Added support for custom queries via
Connection
object - 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
$allowEmpty
toQuerySet->single()
- Added transactions
- Added
QuerySet->dump()
- Added logging via Apache log4php
- Added composite filters
- Initial release