-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* develop: (49 commits) specify next release remove remnants of phpunit fix property name use builtin memory assertion use builtin method to disable memory limit use comparator\property instead of anonymous classes simplify specifications usage in the documentation update changelog fix constructor use named constructors fix CS config fix example simplify documentation update changelog as it now requires specification 4.1 remove phpunit move phpunit tests to blackbox remove logger tests use concrete classes instead of mocks typo fix generating column name with a multibyte string length above 63 ...
- Loading branch information
Showing
91 changed files
with
1,809 additions
and
2,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/composer.lock | ||
/vendor | ||
/.phpunit.result.cache | ||
/.phpunit.cache | ||
/.cache | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ | |
return Innmind\CodingStandard\CodingStandard::config([ | ||
'properties', | ||
'fixtures', | ||
'tests', | ||
'src', | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ use Formal\AccessLayer\{ | |
use Innmind\Url\Url; | ||
use Innmind\Immutable\Sequence; | ||
|
||
$connection = new Lazy(static fn() => PDO::of(Url::of('mysql://user:[email protected]:3306/database_name'))); | ||
$connection = Lazy::of(static fn() => PDO::of(Url::of('mysql://user:[email protected]:3306/database_name'))); | ||
|
||
$rows = $connection(SQL::of('SELECT * FROM `some_table`')); | ||
$rows; // instanceof Sequence<Row> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,11 @@ use Formal\AccessLayer\{ | |
}; | ||
use Innmind\Url\Url; | ||
|
||
$connection = new Lazy( | ||
$connection = Lazy::of( | ||
static fn() => PDO::of( | ||
Url::of('mysql://user:[email protected]:3306/database_name'), | ||
), | ||
); | ||
``` | ||
|
||
By passing a callable to the constructor allows you to use [whatever implementation](own.md) of a `Connection` you wish to lazy load. | ||
By passing a callable to the constructor it allows you to use [whatever implementation](own.md) of a `Connection` you wish to lazy load. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,35 @@ This is the basic connection from this library which is a simple abstraction on | |
|
||
To build an instance of it you only need the dsn to your database: | ||
|
||
```php | ||
use Formal\AccessLayer\Connection\PDO; | ||
use Innmind\Url\Url; | ||
=== "MySQL/MariaDB" | ||
```php | ||
use Formal\AccessLayer\Connection\PDO; | ||
use Innmind\Url\Url; | ||
|
||
$connection = PDO::of(Url::of('mysql://user:[email protected]:3306/database_name?charset=utf8mb4')); | ||
``` | ||
$connection = PDO::of( | ||
Url::of('mysql://user:[email protected]:3306/database_name?charset=utf8mb4') | ||
); | ||
``` | ||
|
||
When executing a [query](../queries/sql.md) through this connection it will return a [deferred `Sequence`](https://innmind.github.io/Immutable/SEQUENCE.html#defer) of rows. This means that the rows returned from the database are only loaded once you iterate over the sequence. (Queries with the named constructor `::onDemand()` will return a lazy `Sequence`). | ||
=== "PostgreSQL" | ||
```php | ||
use Formal\AccessLayer\Connection\PDO; | ||
use Innmind\Url\Url; | ||
|
||
$connection = PDO::of( | ||
Url::of('pgsql://user:[email protected]:5432/database_name?charset=utf8mb4') | ||
); | ||
``` | ||
|
||
=== "SQLite" | ||
```php | ||
use Formal\AccessLayer\Connection\PDO; | ||
use Innmind\Url\Url; | ||
|
||
$connection = PDO::of(Url::of('sqlite:///path/to/database/file.sq3')); | ||
``` | ||
|
||
When executing a [query](../queries/sql.md) through this connection it will return a [deferred `Sequence`](http://innmind.github.io/Immutable/structures/sequence/#defer) of rows. This means that the rows returned from the database are only loaded once you iterate over the sequence. (Queries with the named constructor `::onDemand()` will return a lazy `Sequence`). | ||
|
||
!!! note "" | ||
As soon as you instanciate the class it will open a connection to the database, if you want to open it upon first query take a look at the [`Lazy` connection](lazy.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.