Skip to content

8.0.1

Choose a tag to compare

@abnegate abnegate released this 12 Oct 03:53
176dd25

8.0.1 restores the 7.4.1 behaviour that 8.0.0 changed for callers of features 7.x already had. New 8.0 features are
unchanged. It also holds nested relationship links to the permission rule UPGRADE.md states.

Added

  • Database::authorizeCreate(string $collection, Document $document) and Database::authorizeUpdate(string $collection, Document $old, Document $document) run the permission checks of a later createDocument() or
    updateDocument() without writing: create on the collection (update on the document for an update, document-level
    under document security) and, when the relationship hook is attached and enabled, every nested related document
    as deep as the write relates it. They throw Exception\Authorization with the reason the write would give. Use
    them to refuse a write you stage to run later, such as a transaction operation, when it is staged.

Fixed

  • Query validation reports what 7.x reported: the children of and(), or() and elemMatch() are validated before
    the query itself, the first invalid query in reading order sets the message even when a later one does not parse,
    a method 7.x could not parse that no validator takes reads Invalid query: Invalid query method: <method>, and a
    raw query from a string reads Invalid query method: raw.
  • select('$tenant') passes query validation again without shared tables, and the read refuses it with Cannot select attributes: $tenant, as in 7.x.
  • The UID validator description is the 7.x text again, also inside Invalid cursor: ….
  • On PostgreSQL an exact search ("foo bar") matches every word in any order again, not the adjacent phrase.
  • containsAll() on an attribute that is not an array matches each value as a whole-value LIKE (ILIKE on
    PostgreSQL) pattern, any of them, on MariaDB, MySQL and PostgreSQL, as in 7.x.
  • A read whose orders include orderRandom() ignores its cursor instead of failing with Order attribute '' is empty.
  • document_purge fires inside the write's outermost transaction, just before it commits, so a listener that throws
    rolls the write back and its failure reaches the caller, as in 7.x.
  • increaseDocumentAttribute() and decreaseDocumentAttribute() pass a fractional change, max or min on an
    integer attribute to the engine again and return the exact sum, and refuse a change that is not above zero with
    \InvalidArgumentException, as in 7.x.
  • Numeric operators on integer and double attributes are checked as in 7.x: a fractional change or limit, or a
    fractional item appended to an integer array, is no longer refused.
  • A mismatched attribute default reads Default value x does not match given type <type> (and is not a valid integer string for type bigint) without JSON quoting, as in 7.x.
  • Index::fromArray() refuses an unknown index type with Exception\Index (Unknown index type: …) instead of
    creating a key index.
  • Exception\Unique::MESSAGE is Unique index violation again.
  • A many-to-many relationship created by 7.x can be renamed again: its junction index, which 7.x stored with key
    index_<key>, is read under its $id _index_<key>.
  • The SQL adapters bind floats as 7.x did: fixed-point only in find(), as PHP writes them elsewhere, so a write
    no longer stores 1e-300 or -2.5e-20 as 0.
  • Two-level relationship selects (author.profile.*, tags.books.name) return the related documents' attributes
    as in 7.x, and select(['*', '*.*']) reads every column instead of failing on MariaDB, MySQL and PostgreSQL.
  • A single read returns $sequence ahead of $id, in 7.x's key order, on every adapter.
  • An update validates the stored values it leaves unchanged again, as 7.x did; a stored object value is held to
    7.x's object rules.
  • On MongoDB a transaction that lost a write conflict runs again up to 20 times, so concurrent increments of one
    document all land.
  • With dates preserved, linking existing children through their one-to-many parent keeps each child's stored
    $updatedAt, as 7.x did; unlinking still stamps the child.
  • Linking a stored related document by ID needs update permission on it for every relationship type, as UPGRADE.md
    states: a one-way one-to-one link, a many-to-one link and a one-to-many child pointing at its parent linked with
    read permission alone in 8.0.0, as in 7.x.
  • A nested write refuses a stored related document the caller cannot read with Exception\Authorization: with the
    read check's reason when it is given by ID, with the update check's reason (or the read check's when the caller may
    update) when it is given as a document. 8.0.0 left a half link to it (one-to-one, many-to-one), dropped it
    silently (one-to-many, many-to-many) or tried to create it, failing with Exception\Duplicate.
  • A stored two-way one-to-one or one-to-many related document given as a document in a new parent is linked to
    it; 8.0.0 and 7.x updated it but left its reference to the parent empty.

Full Changelog: 8.0.0...8.0.1