Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad0956b
require php 8.4
Baptouuuu Nov 17, 2025
be36500
reuse workflows
Baptouuuu Nov 17, 2025
bf1e24c
add workflow to create releases
Baptouuuu Nov 17, 2025
0d7c2f0
remove unused PDO::persistent()
Baptouuuu Nov 17, 2025
1f7c9e5
make Connection a final class
Baptouuuu Nov 17, 2025
8ad9771
only keep the implementation once loaded
Baptouuuu Nov 17, 2025
6b4a59f
add Query\Builder interface
Baptouuuu Nov 17, 2025
360fb4b
rename ::onDemand() named constructors as ::lazily() and deprecate ol…
Baptouuuu Nov 17, 2025
8d38fa4
the builder needs the driver in order to know how to format the sql
Baptouuuu Nov 17, 2025
536426b
fix reaching transaction cases
Baptouuuu Nov 17, 2025
a5b9e69
allow to specify all the query parameters at once
Baptouuuu Nov 17, 2025
3b04e56
make custom queries implement Query\Builder
Baptouuuu Nov 17, 2025
9dc963b
make Query a final class
Baptouuuu Nov 17, 2025
9fc37ce
no need to pass the Driver to Query::sql() as the sql is already form…
Baptouuuu Nov 17, 2025
7683c55
normalize where clauses in a single operation
Baptouuuu Nov 17, 2025
21407f3
fix tests
Baptouuuu Nov 17, 2025
b210f31
require blackbox 6
Baptouuuu Nov 17, 2025
1deee46
update dependencies
Baptouuuu Nov 17, 2025
8295c74
capture connection failures in an attempt
Baptouuuu Nov 18, 2025
7cc0a17
defer the loading of pdo connections
Baptouuuu Nov 18, 2025
4a97c06
remove no longer needed lazy connections
Baptouuuu Nov 18, 2025
431f22f
fix logging queries with the incorrect driver
Baptouuuu Nov 18, 2025
5bd2a9c
CS
Baptouuuu Nov 18, 2025
579884a
add missing attributes
Baptouuuu Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 4 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php-version: ['8.2', '8.3', '8.4']
php-version: ['8.4']
dependency-versions: ['lowest', 'highest']
name: 'BlackBox'
services:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php-version: ['8.2', '8.3', '8.4']
php-version: ['8.4']
dependency-versions: ['lowest', 'highest']
name: 'Coverage'
services:
Expand Down Expand Up @@ -92,41 +92,6 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2', '8.3']
dependencies: ['lowest', 'highest']
name: 'Psalm'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Psalm
run: vendor/bin/psalm --shepherd
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@next
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2']
name: 'CS'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
- name: CS
run: vendor/bin/php-cs-fixer fix --diff --dry-run
uses: innmind/github-workflows/.github/workflows/cs.yml@next
22 changes: 2 additions & 20 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,9 @@ name: Documentation
on:
push:
branches: [master]

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
uses: innmind/github-workflows/.github/workflows/documentation.yml@main
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Create release

on:
push:
tags:
- '*'

jobs:
release:
uses: innmind/github-workflows/.github/workflows/release.yml@main
secrets: inherit
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [Unreleased]

### Added

- `Formal\AccessLayer\Query\Builder`
- `Formal\AccessLayer\Query\SQL` named constructors allow to pass all the parameters at once via the second argument

### Changed

- Requires PHP `8.4`
- `Formal\AccessLayer\Connection` is now a final class, all previous implementations are now flagged as internal
- `Formal\AccessLayer\Query` is now a final class
- Requires `innmind/black-box:~6.5`

### Deprecated

- `Formal\AccessLayer\Query\Select::onDemand()`, use `::lazily()` instead
- `Formal\AccessLayer\Query\SQL`, use `Formal\AccessLayer\Query` instead

### Removed

- `Formal\AccessLayer\Connection\PDO::persistent()`
- `Formal\AccessLayer\Query\Where::sql()` and `::parameters()`, use `::normalize()` instead

## 4.2.0 - 2025-04-09

### Added
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"issues": "http://github.com/formal-php/access-layer/issues"
},
"require": {
"php": "~8.2",
"innmind/immutable": "~4.0|~5.0",
"innmind/url": "~4.0",
"php": "~8.4",
"innmind/immutable": "dev-next",
"innmind/url": "dev-next",
"innmind/specification": "~4.1",
"psr/log": "~3.0"
},
Expand All @@ -35,16 +35,16 @@
},
"require-dev": {
"innmind/static-analysis": "^1.2.1",
"innmind/black-box": "^5.8|^6.0.2",
"innmind/black-box": "~6.5",
"innmind/coding-standard": "~2.0"
},
"conflict": {
"innmind/black-box": "<5.0|~7.0"
"innmind/black-box": "<6.0|~7.0"
},
"suggest": {
"innmind/black-box": "For property based testing"
},
"provide": {
"innmind/black-box-sets": "5.0"
"innmind/black-box-sets": "6.0"
}
}
14 changes: 6 additions & 8 deletions fixtures/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ final class Column
*/
public static function any(?Set $type = null, ?int $max = null): Set
{
return Set\Randomize::of( // randomize to prevent same name used twice
Set\Composite::immutable(
Model::of(...),
Column\Name::any($max),
$type ?? Column\Type::any(),
),
);
return Set::compose(
Model::of(...),
Column\Name::any($max),
$type ?? Column\Type::any(),
)->randomize();
}

/**
* @return Set<list<Model>>
*/
public static function list(): Set
{
return Set\Sequence::of(self::any())
return Set::sequence(self::any())
->between(1, 20)
->map(static function($columns) {
$filtered = [];
Expand Down
9 changes: 5 additions & 4 deletions fixtures/Table/Column/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ public static function any(?int $max = null): Set
{
$max ??= 64;

return Set\Strings::madeOf(
Set\Chars::alphanumerical(),
Set\Elements::of('é', 'è', 'ê', 'ë', '_'),
)
return Set::strings()
->madeOf(
Set::strings()->chars()->alphanumerical(),
Set::of('é', 'è', 'ê', 'ë', '_'),
)
->between(1, $max)
->filter(static fn($string) => \mb_strlen($string, 'ascii') < $max)
->map(Model::of(...));
Expand Down
Loading