-
v2, RC 1 Pre-Release
released this
2024-10-02 01:41:57 +00:00 | 2 commits to main since this releaseThis version is a PHP 8.4+ change of this library. There are two major API changes:
- On
DocumentList
,items
andhasItems
are now properties rather than functions. - In the dependent
InspiredByFSharp
library, several functions onOption
andResult
are now properties. See its README for a table with their new APIs.
Version 1 of this library will continue to be supported, including to a full release status. Making this major revision change is the best way for composer to be able to tell which one should be installed; version 1 requires PHP 8.2 or 8.3, while this library requires 8.4 or greater.
Downloads
- On
-
v1, RC 1 Pre-Release
released this
2024-10-01 00:31:33 +00:00 | 3 commits to main since this releaseThis version fixes a bug where
ORDER BY
clauses were not generated correctly if the field had a qualifier.This version also restricts PHP versions to 8.2.* or 8.3.*. A forthcoming v2 of this library will target PHP 8.4, using properties in some places where functions are currently used. v1 will be supported.
Downloads
-
v1, Beta 10 Pre-Release
released this
2024-09-27 02:30:09 +00:00 | 4 commits to main since this releaseLots of good stuff here!
- There are two new field comparisons;
in
implements anIN
comparison against a field, andinArray
does the same thing for fields that are themselves JSON arrays. - The
Find
functions (exceptbyId
) now support an array ofField
s, as their last parameter, which will be used to order the results. There is also a newField::named()
function which can be used to create field definitions for this purpose. These names follow the same rules as other field names (use "a.b.c" for nested fields), but they support other features as well.- To sort descending, include DESC in the name (ex.
Field::named('code DESC')
). - To specify a null clause, include it as well (ex.
Field::named('example NULLS FIRST')
). - To sort the field as a number, prefix the field name with
n:
(ex.Field::named('n:ranking')
). PostgreSQL will cast the field to a number, while SQLite will do its usual best-guess. - To sort case-insensitively, prefix the field name with
i:
(ex.Field::named('i:comment')
). SQLite's default is case-sensitive sorting, with uppercase values first. PostgreSQL's behavior is based on libraries in the underlying operating system; some are case-insensitive by default, but others (particularly Mac OS) are case-sensitive.
- To sort descending, include DESC in the name (ex.
- The names of the comparisons in
Field
constructor functions are now spelled out (ex.Field::equal
instead ofField::EQ
). The two-character versions remain as aliases, so this will not break existing code. - The project now comes back clean for PHPStan level 6, and had some changes flagged on higher levels. One of these changes may fix an issue where IDEs were not picking up the generic type coming from
DocumentList->items()
.
Downloads
- There are two new field comparisons;
-
v1, Beta 9 Pre-Release
released this
2024-07-29 20:59:59 +00:00 | 5 commits to main since this releaseThis release mostly picks up the updated option/result library. However, the breaking change from beta8 that dropped
getOrThrow()
from theOption
s returned from this library is no longer an issue; this library update implements the method.Downloads
-
v1, Beta 8 Pre-Release
released this
2024-07-29 00:23:07 +00:00 | 6 commits to main since this releaseBREAKING CHANGE
TheOption
implementation has been swapped fromPhpOption
toBitBadger\InspiredByFSharp
. There are a few ways to fix syntax errors that may be encountered:- The new library's
Option
instances have atoPhpOption()
method; add that to the end of the option-returning call, and everything should work fine. - The new library's
Option
instances useget()
to obtain the value; these calls will not need to change. - The new library uses
isSome()
in place ofisDefined()
, andisNone()
in place ofisEmpty()
. - The new library does not (yet) have
getOrThrow()
.
FEATURE
DocumentList
now has amapToArray()
method; this will map an associative array of key/value pairs from the items in the list. One potential use for this is obtaining a list of IDs and names to generate an HTML<select>
element.$lookup = $list->mapToArray(fn($it) => $it->id, fn($it) => $it->name);
will generate such an array from aDocumentList
instance, with no requirement to create an intermediate array of documents.Downloads
- The new library's
-
v1, Beta 7 Pre-Release
released this
2024-07-25 01:04:23 +00:00 | 10 commits to main since this releaseIt's
DocumentList
's turn in the spotlight.map(callable(TDoc): U)
creates a generator which transforms results rather than returning them directly asitems()
does.iter(callable(TDoc))
iterates the item list without transformations.items()
will now throw aDocumentException
if it is called after the generator has been consumed.- Finally, there is a section in the documentation dedicated to
DocumentList
and its usage.
Downloads
-
v1, Beta 6 Pre-Release
released this
2024-07-22 15:16:08 +00:00 | 12 commits to main since this releaseBREAKING CHANGES:
- Instead of setting
Configuration::$pdoDSN
, callConfiguration::useDSN()
instead. This allows the library to derive its mode based on the data source name (DSN) being set, rather than waiting for the first time a call is made. - Related to the above, it should no longer be necessary to set the mode directly.
Configuration::$mode
is no longer visible.
I debated making these changes with a beta digit release, but they should be targeted to one or two lines in each dependent application, and I was having trouble justifying the (somewhat convoluted) way it currently worked as I was writing the documentation. Speaking of documentation...
DOCUMENTATION IS NOW LIVE! This was a "coming during beta testing" to-do list item, and it has now been accomplished. There is much more detail about how to set up and use the library there.
Downloads
- Instead of setting
-
v1, Beta 5 Pre-Release
released this
2024-07-04 17:18:01 +00:00 | 15 commits to main since this releaseThis fixes a logic flaw in beta 4 around handling empty arrays.
Downloads