Repository navigation
8.1.2
8.1.2 removes public API that nothing outside the library needed, replaces the opt-in emulation of 7.4.1's fractional
arithmetic on integer attributes with one rounding rule that always applies, and moves the update models into the
namespace of the model they update. Every entry under Removed and Changed (breaking) needs a code change; see
Upgrading from 8.1.1 to 8.1.2 for each replacement.
Removed (breaking)
Database::read(), added in 8.1.0. Callfind()for documents andaggregate()for aggregate orgroupBy()
queries;Query::groupByType($queries)->isAggregation()tells which of the two a list is.find()still refuses
aggregate andgroupBy()queries.Database::rawQuery(). UseDatabase::query(new Utopia\Query\Builder\Statement($query, $bindings)), which runs
the same statement under the same authorization guard.Feature\RawQueryand the adapters'rawQuery()stay.Database::getRelationshipHook(). Keep theHook\Relationshipsgiven toaddHook().Database::getMaxIndexLength(),getMaxVarcharLength(),getMinDateTime()andgetMaxDateTime(). Read
indexLength,varchar,minDateTimeandmaxDateTimefrom$database->getAdapter()->limits().Database::getCacheWriterTimeout().Database::setRoundFractions(),isRoundingFractions()andwithRoundFractions(), with theMirroroverrides.
Integer rounding is always on (listed under Changed).Adapter::arithmetic()and its overrides inPostgres,Mongo,SQLite,Memory,RedisandPool;
ReadWritePoolno longer lists it among the methods it answers wherever reads go.Utopia\Database\Arithmetic,Utopia\Database\Arithmetic\Roundingand the internalArithmetic\Decimaland
Arithmetic\Fractional.- The trailing
bool $fractionsargument ofValidator\OperatorandValidator\Structure(and so
Validator\PartialStructure). - The trailing
bool $roundFractionsargument of theState\Snapshotconstructor. Event\Permission\Created,ReadandDeleted, whichDatabasenever dispatched.Event::PermissionsCreate,
PermissionsReadandPermissionsDeletestay as statement labels; theirdomain()isnull.Adapter\SQL\Hook\Permission\AllowNullUid. UseAdapter\SQL\Hook\Column\AllowNull, which it wrapped.
Changed (breaking)
-
The update models moved into the namespace of the model they update. Replace the imports:
8.1.1 8.1.2 Utopia\Database\AttributeUpdateUtopia\Database\Attribute\UpdateUtopia\Database\CollectionUpdateUtopia\Database\Collection\UpdateUtopia\Database\RelationshipUpdateUtopia\Database\Relationship\UpdateTheir constructors and fields are unchanged.
Changed
- On a single-valued integer or big integer attribute,
increaseDocumentAttribute()anddecreaseDocumentAttribute()
round a fractional change half away from zero (1.5 adds 2, 2.5 subtracts 3), floor a fractionalmaxand ceil a
fractionalmin;Operator::increment()andOperator::decrement()given toupdateDocument(),
updateDocuments(),upsertDocument()andupsertDocuments()round their amount and limit the same way, so
increment(-2.5)subtracts 3. Rounding happens once, in PHP, before validation and on every adapter alike. Decimal
text, which is whatis_numeric()accepts without an exponent, such as'9007199254740993.5',' +.5'or'1.',
is rounded exactly at any size; text with an exponent is refused. A change that rounds to 0, such as 0.4, changes
nothing and skips themaxormincheck: a counter writes nothing and fires no event, and an operator is dropped
from the update, soupdateDocuments()with nothing else to change returns 0. Before, these were refused, unless
setRoundFractions(true)stored what the adapter's engine stored on 7.4.1. - Refused with
Exception\Structure, as in 8.0.3 and in 8.1.1 withoutsetRoundFractions(true): a fractional amount
or limit ofmultiply(),divide(),modulo()orpower()on an integer attribute, and a fractional item added to
an integer array.setRoundFractions(true)resolved the operators and cut the array items toward zero. Float and
double attributes are unchanged.
Added
Adapter\Pool::getPool(): Utopia\Pools\Poolreturns the pool of adapters the handle borrows from.
Fixed
Adapter\Pool::hostname()returns the hostname given tosetHostname()when it is not empty, and asks the pooled
adapter only otherwise. 8.1.1 ignored it, soDatabase::getHostname()and the cache keys built from it named the
pooled adapter's host instead.ReadWritePoolalso follows a hostname set after its first answer.