The methods Table::updateRowPerform() and deleteRowPerform() now throw an exception when the table does not have a primary key.
Also updated docs.
This release implements IteratorAggregate on Row objects so you can foreach() over their columns.
Also, Row::isModified() now booleans compares as integers, so that a change from 1 => true or 0 => false (and vice versa) is no longer considered a difference. This should help reduce "Expected 1 row affected, actual 0" errors with some databases (notably MySQL).
This release adds automatic identifier quoting for the FROM/INTO table name (via
Table::select()
, insert()
, update()
, and delete()
) as well as automatic
identifier quoting for primary key column names (via Table::fetchRow()
and
fetchRows()
).
Updated docs and tests accordingly.
Added method TableLocator::getConnectionLocator()
.
Moves the check to see if a column exists from Table::newRow()
to Row::__construct()
.
Row::__construct()
now calls Row::assertValidValue()
on column value inputs.
This release incorporates some documentation fixes and an added benchmarking
script at tests/bench.php
.
First stable release.
TableEvent::beforeInsertRow() now returns ?array
instead of void
. The
returned array will be used for the insert values; this allows consumers to
explicitly control which values will be inserted, and to validate the values
early on. (If a null is returned, the insert will use $row->getArrayCopy()
.)
Likewise, TableEvent::beforeUpdateRow() now returns ?array
instead of void
.
The returned array will be used for the update values; this allows consumers to
explicitly control which values will be updated, and to validate the values
early on. (If a null is returned, the update will use $row->getArrayDiff()
.)
These are both BC breaks for implementors of TableEvents::beforeInsertRow() and beforeUpdateRow().
Added methods Table::selectRow() and selectRows() so you can pass in an externally-constructed Select object to fetch rows by primary key; this is useful with, e.g., MapperSelect queries modified by their own events.
This release introduces one BC-breaking change from beta1: the TableEvents methods have been renamed from (before|modify|after)(Insert|Update|Delete) to append the word Row. For example, TableEvents::beforeUpate() is now TableEvents::beforeUpdateRow(). If you have implemented these methods in your custom TableEvents classes, you will need to change to the new names; the signatures and logic remain otherwise identical. There is no effect on generated classes.
There are new modify(Insert|Update|Delete) TableEvents methods that now apply to insert(), update(), and delete() respectively. These allow you a chance to modify the table-wide operation before working with the query object directly.
This release also adds a PHPStorm metadata resource, and updates the docs.
This release adds type-specific TableSelect classes (to aid IDEs with return
typehint completion) and a new Row::getArrayInit()
method.
Initial release.