Compare commits

..

No commits in common. "master" and "1.0.2" have entirely different histories.

3 changed files with 11 additions and 26 deletions

View file

@ -6,10 +6,10 @@ This library retrievies and optionally resolves foreign keys in a MySQL/MariaDB
## Install with composer
```
composer require victorwesterlund/innodb-fk
composer require victorwesterlund/libinnodb-fk
```
```php
use victorwesterlund\ForeignKeys
use victorwesterlund\ForeignKeys\ForeignKeys
```
# Example / Documentation
@ -25,7 +25,7 @@ Remember to pass the database name where InnoDB foreign keys are stored to the 4
## Initialize `ForeignKeys`
```php
use victorwesterlund\ForeignKeys
use victorwesterlund\ForeignKeys\ForeignKeys
$fk = new ForeignKeys($host, $user, $pass, ForeignKeys::DATABASE_NAME);
```
@ -55,14 +55,8 @@ Retrieve rows from your database and pass them to `resolve_all()` as an array of
```php
$rows = [
[
"id" => 1,
"fk" => 2
],
[
"id" => 2,
"fk" => 1
]
"id" => 1,
"fk" => 2
];
$rows = $fk->for("test", "bar")->resolve_all($rows);
@ -70,19 +64,10 @@ $rows = $fk->for("test", "bar")->resolve_all($rows);
```php
// $rows will become
[
[
"id" => 1,
"fk" => [
"id" => 2,
"value" => "lorem ipsum dolor sit amet"
]
],
[
"id" => 2,
"fk" => [
"id" => 1,
"value" => "consectetur adipiscing elit"
]
"id" => 1,
"fk" => [
"id" => 2,
"value" => "hello world"
]
]
```

View file

@ -12,7 +12,7 @@
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"victorwesterlund\\": "src/"
"ForeignKeys\\": "src/"
}
},
"require": {

View file

@ -1,6 +1,6 @@
<?php
namespace victorwesterlund;
namespace victorwesterlund\ForeignKeys;
use \victorwesterlund\xEnum;
use \libmysqldriver\MySQL as MySQLDriver;